diff --git a/pymath/calculus/abstract_polynom.py b/pymath/calculus/abstract_polynom.py index b6a1ac0..a762522 100644 --- a/pymath/calculus/abstract_polynom.py +++ b/pymath/calculus/abstract_polynom.py @@ -327,6 +327,16 @@ class AbstractPolynom(Explicable): 6 x^{ 2 } + 12 x + 3 >>> 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, +]>] + >>> 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]) >>> Q = AbstractPolynom([P,3], 'y') >>> Q @@ -345,10 +355,6 @@ class AbstractPolynom(Explicable): 3 y + 2 x + 1 + 1 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 = [] for coef in self._coef: @@ -367,7 +373,7 @@ class AbstractPolynom(Explicable): ini_step = [Step(self)] 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( ini_step @@ -398,7 +404,6 @@ class AbstractPolynom(Explicable): 7 >>> c.steps [< Step [2, 2, *, 3, +]>, < Step [4, 3, +]>, < Step [4, 3, +]>, < Step [7]>] - """ # Simplify each element before adding them smpl_elem = []