solve bug with the changing render in polynom
This commit is contained in:
parent
c35ca2f2a8
commit
af18870786
@ -257,9 +257,10 @@ class Polynom(object):
|
|||||||
|
|
||||||
elif type(coef) == Expression:
|
elif type(coef) == Expression:
|
||||||
|
|
||||||
|
old_render = Expression.get_render()
|
||||||
Expression.set_render(lambda _,x:Expression(x))
|
Expression.set_render(lambda _,x:Expression(x))
|
||||||
coef_steps = list(coef.simplify())
|
coef_steps = list(coef.simplify())
|
||||||
Expression.set_default_render()
|
Expression.set_render(old_render)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
coef_steps = [coef]
|
coef_steps = [coef]
|
||||||
@ -409,14 +410,18 @@ def test(p,q):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
#from .fraction import Fraction
|
#from .fraction import Fraction
|
||||||
|
Expression.set_render(txt)
|
||||||
p = Polynom([0, -2 ])
|
p = Polynom([0, -2 ])
|
||||||
q = Polynom([4, 0, 4])
|
q = Polynom([4, 0, 4])
|
||||||
test(p,q)
|
r = (p-q)[-1]
|
||||||
|
print(r)
|
||||||
|
|
||||||
print("\n")
|
#test(p,q)
|
||||||
p = Polynom([[1,0], [2,3,0]])
|
|
||||||
for i in p.simplify():
|
#print("\n")
|
||||||
print(i)
|
#p = Polynom([[1,0], [2,3,0]])
|
||||||
|
#for i in p.simplify():
|
||||||
|
# print(i)
|
||||||
|
|
||||||
#q = Polynom([0, Fraction(1,2), 0, Fraction(-4,3)])
|
#q = Polynom([0, Fraction(1,2), 0, Fraction(-4,3)])
|
||||||
#test(p,q)
|
#test(p,q)
|
||||||
|
Loading…
Reference in New Issue
Block a user