On Thu, Apr 30, 2009 at 3:01 AM, Colin Gillespie <c.gilles...@ncl.ac.uk> wrote: > > Hi, > > In the code: > >>>> x=sympify('pow(PZ,2)') >>>> x > pow(PZ, 2) >>>> Poly(x,Symbol('PZ')) > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/data/ncsg3/pythonModules/lib/python2.5/site-packages/ > sympy-0.6.4-py2.5.egg/sympy/polys/polynomial.py", line 402, in __new__ > terms = Poly._decompose(poly, *symbols) > File "/data/ncsg3/pythonModules/lib/python2.5/site-packages/ > sympy-0.6.4-py2.5.egg/sympy/polys/polynomial.py", line 545, in > _decompose > raise PolynomialError("Can't decompose %s" % factor) > sympy.polys.polynomial.PolynomialError: Can't decompose pow(PZ, 2) > > Is this expected behaviour or should sympify convert pow(PZ,2) to > PZ^2?
The sympify is indeed wrong. Could you debug what kind of "pow" it generated? It's something different than if you type pow(PZ, 2) yourself, as you can see here: In [1]: sympify("pow(PZ, 2)") Out[1]: pow(PZ, 2) In [2]: var("PZ") Out[2]: PZ In [3]: pow(PZ, 2) Out[3]: 2 PZ Thanks, Ondrej --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---