Hi,
I'm relatively new to sympy and am trying to work with Laurent polynomials
(i.e. polynomials potentially having monomials of negative degree). This is
in principle supported by sympy by introducing an additional symbol 1/x.
What is a little strange is the following behavior:
>>> from sympy import *
>>> x = symbols('x')
>>> degree(x,1/x)
0
... not the answer I would have hoped for, but ok
>>> degree(1/x,x)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/sympy/polys/polytools.py", line
3909, in degree
F, opt = poly_from_expr(f, *gens, **args)
File "/usr/lib/python2.7/dist-packages/sympy/polys/polytools.py", line
3741, in poly_from_expr
return _poly_from_expr(expr, opt)
File "/usr/lib/python2.7/dist-packages/sympy/polys/polytools.py", line
3763, in _poly_from_expr
rep, opt = _dict_from_expr(expr, opt)
File "/usr/lib/python2.7/dist-packages/sympy/polys/polyutils.py", line
314, in _dict_from_expr
rep, gens = _dict_from_expr_if_gens(expr, opt)
File "/usr/lib/python2.7/dist-packages/sympy/polys/polyutils.py", line
260, in _dict_from_expr_if_gens
(poly,), gens = _parallel_dict_from_expr_if_gens((expr,), opt)
File "/usr/lib/python2.7/dist-packages/sympy/polys/polyutils.py", line
167, in _parallel_dict_from_expr_if_gens
raise PolynomialError("%s contains an element of the generators set" %
factor)
sympy.polys.polyerrors.PolynomialError: 1/x contains an element of the
generators set
Thinking of these as Laurent polynomials x and 1/x play interchangeable
roles, so it is not clear why they are treated differently. Also, reduction
of the expression x*(1/x) to 1 does not happen after each computation, so I
am wondering whether there is maybe a more appropriate type for Laurent
polynomials? Thanks already for any help!
Best wishes,
Stefan
--
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 http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.