Presumably mateusz (or aaron) know better than me, but the problem is
simply that polys does not really work well with Floats.
There is also an open issue (2384) related to this.
On 24.05.2011 20:13, Chris Smith wrote:
Andy Ray Terrel wrote:
Quite strange indeed.
On my Mac Python 2.7, sympy.__version__ = 0.6.7 I get:
In [17]: expr = (2.1 - 2.1*y**2 + 2*x)/x**3
In [18]: sympy.simplify(expr)
Out[18]: -inf
This raises an error for me:
raise ValueError("can't raise polynomial to a negative power")
ValueError: can't raise polynomial to a negative power
But if I nsimplify(..., rational=True) everthing works ok:
h[12]>>> e1= (2.1 - 2.1*y**2 + 2*x)/x**3
h[12]>>> e2= (2.1*x*(1-y)**2+2*y*x)/ x**3
h[12]>>> e3= (sympy.Rational(21,10)*x*(1-y)**2 + 2*y*x) / X**3
h[12]>>> for e in [e1,e2,e3]:
... print simplify(nsimplify(e,rational=True))
...
(20*x - 21*y**2 + 21)/(10*x**3)
(21*y**2 - 22*y + 21)/(10*x**2)
x*(21*y**2 - 22*y + 21)/(10*X**3)
CAUTION: you used an X instead of an x in the last equation.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.