Abs_poly handle 2var poly. Need to adapt Poly know

This commit is contained in:
Benjamin Bertrand 2016-03-12 06:10:28 +03:00
parent 3abd4e89b5
commit a564708a31

View File

@ -275,7 +275,6 @@ class AbstractPolynom(Explicable):
pstfx = postfix_op(raw_coefs[::-1], op.add) pstfx = postfix_op(raw_coefs[::-1], op.add)
return flatten_list(pstfx) return flatten_list(pstfx)
def conv2poly(self, other): def conv2poly(self, other):
"""Convert anything number into a polynom """Convert anything number into a polynom
@ -284,10 +283,18 @@ class AbstractPolynom(Explicable):
< AbstractPolynom x [1]> < AbstractPolynom x [1]>
>>> P.conv2poly(0) >>> P.conv2poly(0)
< AbstractPolynom x [0]> < AbstractPolynom x [0]>
>>> Q = AbstractPolynom([3, 2, 1], 'x')
>>> P.conv2poly(Q)
< AbstractPolynom x [3, 2, 1]>
>>> Q = AbstractPolynom([3, 2, 1], 'y')
>>> P.conv2poly(Q)
< AbstractPolynom x [< AbstractPolynom y [3, 2, 1]>]>
""" """
if isNumber(other) and not isPolynom(other): if (isNumber(other) and not isPolynom(other)) or \
return AbstractPolynom([other], letter=self._letter) (isPolynom(other) and self._letter != other._letter):
ans = self.__class__([other], letter=self._letter)
ans.steal_history(other)
return ans
elif isPolynom(other): elif isPolynom(other):
return other return other
else: else: