all test pass!
It was an issue with reduce and not 'y' poly
This commit is contained in:
parent
f62f572fb3
commit
9dd3f750b6
@ -327,6 +327,16 @@ class AbstractPolynom(Explicable):
|
|||||||
6 x^{ 2 } + 12 x + 3
|
6 x^{ 2 } + 12 x + 3
|
||||||
>>> Q.steps
|
>>> Q.steps
|
||||||
[< Step [6, 'x', 2, ^, *, 3, 'x', *, +, 4, 'x', *, +, 5, 'x', *, +, 1, +, 2, +]>, < Step [6, 'x', 2, ^, *, 3, 4, +, 5, +, 'x', *, +, 1, 2, +, +]>, < Step [6, 'x', 2, ^, *, 7, 5, +, 'x', *, +, 3, +]>, < Step [6, 'x', 2, ^, *, 12, 'x', *, +, 3, +]>]
|
[< Step [6, 'x', 2, ^, *, 3, 'x', *, +, 4, 'x', *, +, 5, 'x', *, +, 1, +, 2, +]>, < Step [6, 'x', 2, ^, *, 3, 4, +, 5, +, 'x', *, +, 1, 2, +, +]>, < Step [6, 'x', 2, ^, *, 7, 5, +, 'x', *, +, 3, +]>, < Step [6, 'x', 2, ^, *, 12, 'x', *, +, 3, +]>]
|
||||||
|
>>> P = AbstractPolynom([[1,2], [3,4,5], 6], 'y')
|
||||||
|
>>> Q = P.reduce()
|
||||||
|
>>> Q
|
||||||
|
< AbstractPolynom y [3, 12, 6]>
|
||||||
|
>>> for i in Q.explain():
|
||||||
|
... print(i)
|
||||||
|
6 y^{ 2 } + 3 y + 4 y + 5 y + 1 + 2
|
||||||
|
6 y^{ 2 } + ( 3 + 4 + 5 ) y + 1 + 2
|
||||||
|
6 y^{ 2 } + ( 7 + 5 ) y + 3
|
||||||
|
6 y^{ 2 } + 12 y + 3
|
||||||
>>> P = AbstractPolynom([1,2])
|
>>> P = AbstractPolynom([1,2])
|
||||||
>>> Q = AbstractPolynom([P,3], 'y')
|
>>> Q = AbstractPolynom([P,3], 'y')
|
||||||
>>> Q
|
>>> Q
|
||||||
@ -345,10 +355,6 @@ class AbstractPolynom(Explicable):
|
|||||||
3 y + 2 x + 1 + 1
|
3 y + 2 x + 1 + 1
|
||||||
3 y + 2 x + 2
|
3 y + 2 x + 2
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# TODO: Il manque le ini_step |jeu. mars 10 12:39:40 EAT 2016
|
|
||||||
|
|
||||||
# gather steps for every coefficients
|
|
||||||
smpl_coef = []
|
smpl_coef = []
|
||||||
for coef in self._coef:
|
for coef in self._coef:
|
||||||
|
|
||||||
@ -367,7 +373,7 @@ class AbstractPolynom(Explicable):
|
|||||||
|
|
||||||
ini_step = [Step(self)]
|
ini_step = [Step(self)]
|
||||||
for s in Explicable.merge_history(smpl_coef):
|
for s in Explicable.merge_history(smpl_coef):
|
||||||
ini_step.append(Step(AbstractPolynom(s)))
|
ini_step.append(Step(AbstractPolynom(s, self._letter)))
|
||||||
|
|
||||||
ans.this_append_before(
|
ans.this_append_before(
|
||||||
ini_step
|
ini_step
|
||||||
@ -398,7 +404,6 @@ class AbstractPolynom(Explicable):
|
|||||||
7
|
7
|
||||||
>>> c.steps
|
>>> c.steps
|
||||||
[< Step [2, 2, *, 3, +]>, < Step [4, 3, +]>, < Step [4, 3, +]>, < Step [7]>]
|
[< Step [2, 2, *, 3, +]>, < Step [4, 3, +]>, < Step [4, 3, +]>, < Step [7]>]
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Simplify each element before adding them
|
# Simplify each element before adding them
|
||||||
smpl_elem = []
|
smpl_elem = []
|
||||||
|
Loading…
Reference in New Issue
Block a user