solve bug with simplify fraction (which has not be simplified)
This commit is contained in:
parent
2425a2dfca
commit
027a3ac57a
@ -231,10 +231,9 @@ class Polynom(object):
|
||||
else:
|
||||
coef_steps = [coef]
|
||||
try:
|
||||
coef_steps.append(coef.simplify())
|
||||
coef_steps += coef.simplify()
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
# On ajoute toutes ces étapes
|
||||
coefs_steps.append(coef_steps)
|
||||
|
||||
@ -328,6 +327,8 @@ class Polynom(object):
|
||||
|
||||
steps += p.simplify()
|
||||
|
||||
#print("steps -> \n", "\n".join(["\t {}".format(s._coef) for s in steps]))
|
||||
|
||||
return steps
|
||||
|
||||
def __rmul__(self, other):
|
||||
@ -346,26 +347,29 @@ def test(p,q):
|
||||
print(p, "+", q)
|
||||
for i in (p + q):
|
||||
#print(repr(i))
|
||||
#print("\t", str(i.postfix))
|
||||
print("\t", str(i.postfix))
|
||||
print(i)
|
||||
#print((p+q)[-1]._coef)
|
||||
|
||||
print("\n Moins ------")
|
||||
for i in (p - q):
|
||||
#print(repr(i))
|
||||
#print("\t", str(i.postfix))
|
||||
print(i)
|
||||
#print((p-q)[-1]._coef)
|
||||
|
||||
print("\n Multiplier ------")
|
||||
for i in (p * q):
|
||||
#print(repr(i))
|
||||
#print("\t", str(i.postfix))
|
||||
print(i)
|
||||
#print((p*q)[-1]._coef)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from .fraction import Fraction
|
||||
p = Polynom([1, -2 ])
|
||||
q = Polynom([4, 7])
|
||||
q = Polynom([4, 7, 4])
|
||||
test(p,q)
|
||||
|
||||
q = Polynom([0, Fraction(1,2), 0, Fraction(-4,3)])
|
||||
|
Loading…
Reference in New Issue
Block a user