From af18870786ba9acfbf9cd74aaa9454c77177688a Mon Sep 17 00:00:00 2001 From: Lafrite Date: Mon, 22 Dec 2014 15:22:51 +0100 Subject: [PATCH] solve bug with the changing render in polynom --- pymath/polynom.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pymath/polynom.py b/pymath/polynom.py index f77a541..1f37d96 100644 --- a/pymath/polynom.py +++ b/pymath/polynom.py @@ -257,9 +257,10 @@ class Polynom(object): elif type(coef) == Expression: + old_render = Expression.get_render() Expression.set_render(lambda _,x:Expression(x)) coef_steps = list(coef.simplify()) - Expression.set_default_render() + Expression.set_render(old_render) else: coef_steps = [coef] @@ -409,14 +410,18 @@ def test(p,q): if __name__ == '__main__': #from .fraction import Fraction + Expression.set_render(txt) p = Polynom([0, -2 ]) q = Polynom([4, 0, 4]) - test(p,q) + r = (p-q)[-1] + print(r) - print("\n") - p = Polynom([[1,0], [2,3,0]]) - for i in p.simplify(): - print(i) + #test(p,q) + + #print("\n") + #p = Polynom([[1,0], [2,3,0]]) + #for i in p.simplify(): + # print(i) #q = Polynom([0, Fraction(1,2), 0, Fraction(-4,3)]) #test(p,q)