Add bug about operation between expression and other types
This commit is contained in:
parent
9ffde06b9c
commit
eec7c8c2ce
32
bugs
32
bugs
@ -33,4 +33,36 @@
|
|||||||
\frac{ ( -1 ) \times 2 }{ 3 \times 2 }
|
\frac{ ( -1 ) \times 2 }{ 3 \times 2 }
|
||||||
\frac{ -1 }{ 3 }
|
\frac{ -1 }{ 3 }
|
||||||
\frac{ -2 }{ 6 }
|
\frac{ -2 }{ 6 }
|
||||||
|
|
||||||
|
* Opération entre une expression et une fraction ou un Polynom
|
||||||
|
|
||||||
|
In [3]: P = Polynom([1,2,1])
|
||||||
|
|
||||||
|
In [4]: e = Expression("1+2*3")
|
||||||
|
|
||||||
|
In [5]: e + P
|
||||||
|
Out[5]: < <class 'pymath.expression.Expression'> [1, 2, 3, '*', '+', < Polynom [1, 2, 1]>, '+'] >
|
||||||
|
|
||||||
|
In [6]: P + e
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
TypeError Traceback (most recent call last)
|
||||||
|
<ipython-input-6-ff312ef36cdb> in <module>()
|
||||||
|
----> 1 P + e
|
||||||
|
|
||||||
|
/home/lafrite/scripts/pyMath/pymath/polynom.py in __add__(self, other)
|
||||||
|
430 [< <class 'pymath.expression.Expression'> [3, 'x', 2, '^', '*', 2, 'x', '*', '+', 1, '+', 5, 'x', '*', 4, '+', '+'] >, < Polynom [< <class 'pymath.expression.Expression'> [1, 4, '+'] >, < <class 'pymath.expression.Expression'> [2, 5, '+'] >, 3]>, < Polynom [< <class 'pymath.expression.Expression'> [1, 4, '+'] >, < <class 'pymath.expression.Expression'> [2, 5, '+'] >, 3]>]
|
||||||
|
431 """
|
||||||
|
--> 432 o_poly = self.conv2poly(other)
|
||||||
|
433
|
||||||
|
434 n_coef = spe_zip(self._coef, o_poly._coef)
|
||||||
|
|
||||||
|
/home/lafrite/scripts/pyMath/pymath/polynom.py in conv2poly(self, other)
|
||||||
|
319 return other
|
||||||
|
320 else:
|
||||||
|
--> 321 raise ValueError(type(other) + " can't be converted into a polynom")
|
||||||
|
322
|
||||||
|
323 def reduce(self):
|
||||||
|
|
||||||
|
TypeError: unsupported operand type(s) for +: 'type' and 'str'
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user