Issue 2814 in sympy: ValueError: can't raise polynomial to a negative power with solve()

4 views
Skip to first unread message

sy...@googlecode.com

unread,
Oct 30, 2011, 9:18:53 PM10/30/11
to sympy-...@googlegroups.com
Status: Accepted
Owner: ----
Labels: Type-Defect Priority-Medium Solvers Polynomial

New issue 2814 by asme...@gmail.com: ValueError: can't raise polynomial to
a negative power with solve()
http://code.google.com/p/sympy/issues/detail?id=2814

In [84]: solve(((x - 1.1)/(x + 0.1))**(0.83) - C*exp(t), x)
...
ValueError: can't raise polynomial to a negative power


sy...@googlecode.com

unread,
Nov 5, 2011, 4:22:38 PM11/5/11
to sympy-...@googlegroups.com

Comment #1 on issue 2814 by smi...@gmail.com: ValueError: can't raise
polynomial to a negative power with solve()
http://code.google.com/p/sympy/issues/detail?id=2814

>>> from sympy.solvers.solvers import _tsolve
>>> _tsolve(((x - 1.1)/(x + 0.1))**(0.83) - C*exp(t), x)
[0.1*(C*exp(t))**1.20481927710843/(-(C*exp(t))**1.20481927710843 + 1) +
1.1/(-(C
*exp(t))**1.20481927710843 + 1)]


sy...@googlecode.com

unread,
Nov 7, 2011, 9:34:46 AM11/7/11
to sympy-...@googlegroups.com

Comment #2 on issue 2814 by smi...@gmail.com: ValueError: can't raise
polynomial to a negative power with solve()
http://code.google.com/p/sympy/issues/detail?id=2814

Issue 2831 has been merged into this issue.

sy...@googlecode.com

unread,
Dec 20, 2011, 6:42:54 AM12/20/11
to sympy-...@googlegroups.com

Comment #3 on issue 2814 by asme...@gmail.com: ValueError: can't raise
polynomial to a negative power with solve()
http://code.google.com/p/sympy/issues/detail?id=2814

The expression from comment 1 now gives a recursion error, and the one from
comment 1 works.

But the one from issue 2831 still gives the problem. The problem is in
cancel().

Another expression that gives the problem, reported to me on IRC is

a = S("((-2*tanh(x - 3.0)**2 + 2)*(-tanh(x - 3.0)**2 + 1)*tanh(x +
3.0)**2/2 + (-2*tanh(x - 3.0)**2 + 2)*(-2*tanh(x + 3.0)**2 + 2)*tanh(x -
3.0)*tanh(x + 3.0) - (-2*tanh(x - 3.0)**2 + 2)*tanh(x - 3.0)**2*tanh(x +
3.0)**2 + (-2*tanh(x + 3.0)**2 + 2)*(-tanh(x + 3.0)**2 + 1)*tanh(x -
3.0)**2/2 - (-2*tanh(x + 3.0)**2 + 2)*tanh(x - 3.0)**2*tanh(x +
3.0)**2)/(2*sqrt(tanh(x - 3.0)**2*tanh(x + 3.0)**2 + 0.0001)) +
(-(-2*tanh(x - 3.0)**2 + 2)*tanh(x - 3.0)*tanh(x + 3.0)**2/2 - (-2*tanh(x +
3.0)**2 + 2)*tanh(x - 3.0)**2*tanh(x + 3.0)/2)*((-2*tanh(x - 3.0)**2 +
2)*tanh(x - 3.0)*tanh(x + 3.0)**2/2 + (-2*tanh(x + 3.0)**2 + 2)*tanh(x -
3.0)**2*tanh(x + 3.0)/2)/(2*(tanh(x - 3.0)**2*tanh(x + 3.0)**2 +
0.0001)**(3/2))")

sy...@googlecode.com

unread,
Dec 20, 2011, 7:23:15 AM12/20/11
to sympy-...@googlegroups.com
Updates:
Blockedon: 2935

Comment #4 on issue 2814 by asme...@gmail.com: ValueError: can't raise

polynomial to a negative power with solve()
http://code.google.com/p/sympy/issues/detail?id=2814

Well, I remember seeing this before, but I can't find the issue. It happens
because the while loop at line 1310 in densearith.py runs one too many
times, because the floating point coefficients do not cancel like the
algorithm expects them to. I don't know if this can be fixed without
implementing RR(eps). See issue 2935.

sy...@googlecode.com

unread,
Dec 20, 2011, 8:12:47 PM12/20/11
to sympy-...@googlegroups.com

Comment #5 on issue 2814 by smi...@gmail.com: ValueError: can't raise
polynomial to a negative power with solve()
http://code.google.com/p/sympy/issues/detail?id=2814

even if nsimplify is used to give Rationals instead of floats, infinite
recursion is generated.

sy...@googlecode.com

unread,
Apr 3, 2013, 2:27:38 PM4/3/13
to sympy-...@googlegroups.com

Comment #7 on issue 2814 by smi...@gmail.com: ValueError: can't raise
polynomial to a negative power with solve()
http://code.google.com/p/sympy/issues/detail?id=2814

Issue 3575 has been merged into this issue.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

sy...@googlecode.com

unread,
Apr 6, 2013, 9:06:09 AM4/6/13
to sympy-...@googlegroups.com

Comment #8 on issue 2814 by patrick....@gmail.com: ValueError: can't raise
polynomial to a negative power with solve()
http://code.google.com/p/sympy/issues/detail?id=2814

If I try
cancel((z/(x**2) + 0.1*z/sqrt(x**2))**2)
I get the
ValueError: can't raise polynomial to a negative power.
Is it the same issue?

sy...@googlecode.com

unread,
Apr 14, 2013, 7:04:40 PM4/14/13
to sympy-...@googlegroups.com

Comment #9 on issue 2814 by asme...@gmail.com: ValueError: can't raise
polynomial to a negative power with solve()
http://code.google.com/p/sympy/issues/detail?id=2814

https://github.com/sympy/sympy/pull/1921

And your example is fixed there too.

sy...@googlecode.com

unread,
Apr 16, 2013, 2:59:26 AM4/16/13
to sympy-...@googlegroups.com
Updates:
Cc: matt...@gmail.com

Comment #10 on issue 2814 by smi...@gmail.com: ValueError: can't raise
polynomial to a negative power with solve()
http://code.google.com/p/sympy/issues/detail?id=2814

Issue 2384 has been merged into this issue.

sy...@googlecode.com

unread,
May 23, 2013, 1:55:34 AM5/23/13
to sympy-...@googlegroups.com

Comment #11 on issue 2814 by smi...@gmail.com: ValueError: can't raise
polynomial to a negative power with solve()
http://code.google.com/p/sympy/issues/detail?id=2814

The OP expression still hangs and the expression in comment 8 still raises
an error.

sy...@googlecode.com

unread,
May 23, 2013, 10:10:06 PM5/23/13
to sympy-...@googlegroups.com
Updates:
Labels: NeedsReview

Comment #12 on issue 2814 by asme...@gmail.com: ValueError: can't raise
polynomial to a negative power with solve()
http://code.google.com/p/sympy/issues/detail?id=2814

It works in https://github.com/sympy/sympy/pull/2126

sy...@googlecode.com

unread,
Oct 9, 2013, 3:59:29 AM10/9/13
to sympy-...@googlegroups.com
Updates:
Status: Fixed
Labels: -NeedsReview

Comment #13 on issue 2814 by julien.r...@gmail.com: ValueError: can't raise
polynomial to a negative power with solve()
http://code.google.com/p/sympy/issues/detail?id=2814

This has been merged.
Reply all
Reply to author
Forward
0 new messages