A polynomial should not include division and poly() function seems to raise
an error when such an argument is given to it. But several other functions
like degree() gives buggy result instead of raising an error. Shouldn't
they too raise an error?
*>>> a=(x+1)**5/(x-3)*
*>>> poly(a)*
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/usr/local/lib/python3.5/dist-packages/sympy-1.0.1.dev0-py3.5.egg/sympy/polys/polytools.py",
line 6889, in poly
return _poly(expr, opt)
File
"/usr/local/lib/python3.5/dist-packages/sympy-1.0.1.dev0-py3.5.egg/sympy/polys/polytools.py",
line 6839, in _poly
_poly(factor.base, opt).pow(factor.exp))
File
"/usr/local/lib/python3.5/dist-packages/sympy-1.0.1.dev0-py3.5.egg/sympy/polys/polytools.py",
line 1404, in pow
result = f.rep.pow(n)
File
"/usr/local/lib/python3.5/dist-packages/sympy-1.0.1.dev0-py3.5.egg/sympy/polys/polyclasses.py",
line 446, in pow
return f.per(dmp_pow(f.rep, n, f.lev, f.dom))
File
"/usr/local/lib/python3.5/dist-packages/sympy-1.0.1.dev0-py3.5.egg/sympy/polys/densearith.py",
line 978, in dmp_pow
return dup_pow(f, n, K)
File
"/usr/local/lib/python3.5/dist-packages/sympy-1.0.1.dev0-py3.5.egg/sympy/polys/densearith.py",
line 943, in dup_pow
raise ValueError("can't raise polynomial to a negative power")
ValueError: can't raise polynomial to a negative power
*>>> degree(a)*
5
*>>> LT(a)*
x**5/(x - 3)
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit
https://groups.google.com/d/msgid/sympy/c08482e0-afab-4679-91d4-867c6f812354%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.