Comment #13 on issue 3560 by [email protected]: solve() is a giant mess
http://code.google.com/p/sympy/issues/detail?id=3560
Here some (redundant) code picking up (again) some of the mess. The code is
interpreted with Python 3.2.3 and Python 2.7.3. The version of sympy is
given below. First I post the code and then the output within IDLE
import sympy
print(sympy.__version__)
a = sympy.var('a')
x = sympy.Symbol('x')
ss = sympy.solve(x**5 - 5*x + 12)
print(ss)
print([ss[i].n() for i in range(5)])
ss = sympy.solve([x**5 - 5*x + 12], x)
print(ss)
ss = sympy.solve(a**5 - 5*a + 12, a)
print(ss)
print([ss[i].n() for i in range(5)])
ss = sympy.solve([a**5 - 5*a + 12])
print(ss)
ss = sympy.solve([a**4 - 5*a + 12])
print(ss)
ss = sympy.solve([x**4 - 5*x + 12], x)
print(ss)
OUTPUT Python3:
Python 3.2.3 (default, Oct 19 2012, 19:53:57)
[GCC 4.7.2] on linux2
Type "copyright", "credits" or "license()" for more information.
================================ RESTART
================================
0.7.2
[RootOf(x**5 - 5*x + 12, 0), RootOf(x**5 - 5*x + 12, 1), RootOf(x**5 - 5*x
+ 12, 2), RootOf(x**5 - 5*x + 12, 3), RootOf(x**5 - 5*x + 12, 4)]
[-1.84208596619025, -1.84208596619025, -1.84208596619025, 1.2728972239225 -
0.719798681483861*I, 1.2728972239225 + 0.719798681483861*I]
[]
[RootOf(a**5 - 5*a + 12, 0), RootOf(a**5 - 5*a + 12, 1), RootOf(a**5 - 5*a
+ 12, 2), RootOf(a**5 - 5*a + 12, 3), RootOf(a**5 - 5*a + 12, 4)]
[-1.84208596619025, -1.84208596619025, -1.84208596619025, 1.2728972239225 -
0.719798681483861*I, 1.2728972239225 + 0.719798681483861*I]
[]
[{a: -sqrt(8/(25/16 + 3*sqrt(1751)*I/16)**(1/3) + 2*(25/16 +
3*sqrt(1751)*I/16)**(1/3))/2 + sqrt(-2*(25/16 + 3*sqrt(1751)*I/16)**(1/3) -
10/sqrt(8/(25/16 + 3*sqrt(1751)*I/16)**(1/3) + 2*(25/16 +
3*sqrt(1751)*I/16)**(1/3)) - 8/(25/16 + 3*sqrt(1751)*I/16)**(1/3))/2}, {a:
sqrt(8/(25/16 + 3*sqrt(1751)*I/16)**(1/3) + 2*(25/16 +
3*sqrt(1751)*I/16)**(1/3))/2 - sqrt(-2*(25/16 + 3*sqrt(1751)*I/16)**(1/3) +
10/sqrt(8/(25/16 + 3*sqrt(1751)*I/16)**(1/3) + 2*(25/16 +
3*sqrt(1751)*I/16)**(1/3)) - 8/(25/16 + 3*sqrt(1751)*I/16)**(1/3))/2}, {a:
-sqrt(-2*(25/16 + 3*sqrt(1751)*I/16)**(1/3) - 10/sqrt(8/(25/16 +
3*sqrt(1751)*I/16)**(1/3) + 2*(25/16 + 3*sqrt(1751)*I/16)**(1/3)) -
8/(25/16 + 3*sqrt(1751)*I/16)**(1/3))/2 - sqrt(8/(25/16 +
3*sqrt(1751)*I/16)**(1/3) + 2*(25/16 + 3*sqrt(1751)*I/16)**(1/3))/2}, {a:
sqrt(-2*(25/16 + 3*sqrt(1751)*I/16)**(1/3) + 10/sqrt(8/(25/16 +
3*sqrt(1751)*I/16)**(1/3) + 2*(25/16 + 3*sqrt(1751)*I/16)**(1/3)) -
8/(25/16 + 3*sqrt(1751)*I/16)**(1/3))/2 + sqrt(8/(25/16 +
3*sqrt(1751)*I/16)**(1/3) + 2*(25/16 + 3*sqrt(1751)*I/16)**(1/3))/2}]
[(-sqrt(8/(25/16 + 3*sqrt(1751)*I/16)**(1/3) + 2*(25/16 +
3*sqrt(1751)*I/16)**(1/3))/2 + sqrt(-2*(25/16 + 3*sqrt(1751)*I/16)**(1/3) -
10/sqrt(8/(25/16 + 3*sqrt(1751)*I/16)**(1/3) + 2*(25/16 +
3*sqrt(1751)*I/16)**(1/3)) - 8/(25/16 + 3*sqrt(1751)*I/16)**(1/3))/2,),
(sqrt(8/(25/16 + 3*sqrt(1751)*I/16)**(1/3) + 2*(25/16 +
3*sqrt(1751)*I/16)**(1/3))/2 - sqrt(-2*(25/16 + 3*sqrt(1751)*I/16)**(1/3) +
10/sqrt(8/(25/16 + 3*sqrt(1751)*I/16)**(1/3) + 2*(25/16 +
3*sqrt(1751)*I/16)**(1/3)) - 8/(25/16 + 3*sqrt(1751)*I/16)**(1/3))/2,),
(-sqrt(-2*(25/16 + 3*sqrt(1751)*I/16)**(1/3) - 10/sqrt(8/(25/16 +
3*sqrt(1751)*I/16)**(1/3) + 2*(25/16 + 3*sqrt(1751)*I/16)**(1/3)) -
8/(25/16 + 3*sqrt(1751)*I/16)**(1/3))/2 - sqrt(8/(25/16 +
3*sqrt(1751)*I/16)**(1/3) + 2*(25/16 + 3*sqrt(1751)*I/16)**(1/3))/2,),
(sqrt(-2*(25/16 + 3*sqrt(1751)*I/16)**(1/3) + 10/sqrt(8/(25/16 +
3*sqrt(1751)*I/16)**(1/3) + 2*(25/16 + 3*sqrt(1751)*I/16)**(1/3)) -
8/(25/16 + 3*sqrt(1751)*I/16)**(1/3))/2 + sqrt(8/(25/16 +
3*sqrt(1751)*I/16)**(1/3) + 2*(25/16 + 3*sqrt(1751)*I/16)**(1/3))/2,)]
NOW Python2
The (different) code:
import sympy
print(sympy.__version__)
a = sympy.var('a')
x = sympy.Symbol('x')
ss = sympy.solve(x**5 - 5*x + 12)
print(ss)
ss = sympy.solve([x**5 - 5*x + 12], x)
print(ss)
ss = sympy.solve(a**5 - 5*a + 12, a)
print(ss)
ss = sympy.solve([a**5 - 5*a + 12])
print(ss)
ss = sympy.solve([a**4 - 5*a + 12])
print(ss)
ss = sympy.solve([x**4 - 5*x + 12], x)
print(ss)
The output
Python 2.7.3 (default, Sep 26 2012, 21:53:58)
[GCC 4.7.2] on linux2
Type "copyright", "credits" or "license()" for more information.
================================ RESTART
================================
0.7.1.rc1
[]
[]
[]
[]
[((-2*(25/16 + 3*1751**(1/2)*I/16)**(1/3) + 10/(8/(25/16 +
3*1751**(1/2)*I/16)**(1/3) + 2*(25/16 + 3*1751**(1/2)*I/16)**(1/3))**(1/2)
- 8/(25/16 + 3*1751**(1/2)*I/16)**(1/3))**(1/2)/2 + (8/(25/16 +
3*1751**(1/2)*I/16)**(1/3) + 2*(25/16 +
3*1751**(1/2)*I/16)**(1/3))**(1/2)/2,), (-(8/(25/16 +
3*1751**(1/2)*I/16)**(1/3) + 2*(25/16 +
3*1751**(1/2)*I/16)**(1/3))**(1/2)/2 + (-2*(25/16 +
3*1751**(1/2)*I/16)**(1/3) - 10/(8/(25/16 + 3*1751**(1/2)*I/16)**(1/3) +
2*(25/16 + 3*1751**(1/2)*I/16)**(1/3))**(1/2) - 8/(25/16 +
3*1751**(1/2)*I/16)**(1/3))**(1/2)/2,), (-(-2*(25/16 +
3*1751**(1/2)*I/16)**(1/3) - 10/(8/(25/16 + 3*1751**(1/2)*I/16)**(1/3) +
2*(25/16 + 3*1751**(1/2)*I/16)**(1/3))**(1/2) - 8/(25/16 +
3*1751**(1/2)*I/16)**(1/3))**(1/2)/2 - (8/(25/16 +
3*1751**(1/2)*I/16)**(1/3) + 2*(25/16 +
3*1751**(1/2)*I/16)**(1/3))**(1/2)/2,), ((8/(25/16 +
3*1751**(1/2)*I/16)**(1/3) + 2*(25/16 +
3*1751**(1/2)*I/16)**(1/3))**(1/2)/2 - (-2*(25/16 +
3*1751**(1/2)*I/16)**(1/3) + 10/(8/(25/16 + 3*1751**(1/2)*I/16)**(1/3) +
2*(25/16 + 3*1751**(1/2)*I/16)**(1/3))**(1/2) - 8/(25/16 +
3*1751**(1/2)*I/16)**(1/3))**(1/2)/2,)]
[((-2*(25/16 + 3*1751**(1/2)*I/16)**(1/3) + 10/(8/(25/16 +
3*1751**(1/2)*I/16)**(1/3) + 2*(25/16 + 3*1751**(1/2)*I/16)**(1/3))**(1/2)
- 8/(25/16 + 3*1751**(1/2)*I/16)**(1/3))**(1/2)/2 + (8/(25/16 +
3*1751**(1/2)*I/16)**(1/3) + 2*(25/16 +
3*1751**(1/2)*I/16)**(1/3))**(1/2)/2,), (-(8/(25/16 +
3*1751**(1/2)*I/16)**(1/3) + 2*(25/16 +
3*1751**(1/2)*I/16)**(1/3))**(1/2)/2 + (-2*(25/16 +
3*1751**(1/2)*I/16)**(1/3) - 10/(8/(25/16 + 3*1751**(1/2)*I/16)**(1/3) +
2*(25/16 + 3*1751**(1/2)*I/16)**(1/3))**(1/2) - 8/(25/16 +
3*1751**(1/2)*I/16)**(1/3))**(1/2)/2,), (-(-2*(25/16 +
3*1751**(1/2)*I/16)**(1/3) - 10/(8/(25/16 + 3*1751**(1/2)*I/16)**(1/3) +
2*(25/16 + 3*1751**(1/2)*I/16)**(1/3))**(1/2) - 8/(25/16 +
3*1751**(1/2)*I/16)**(1/3))**(1/2)/2 - (8/(25/16 +
3*1751**(1/2)*I/16)**(1/3) + 2*(25/16 +
3*1751**(1/2)*I/16)**(1/3))**(1/2)/2,), ((8/(25/16 +
3*1751**(1/2)*I/16)**(1/3) + 2*(25/16 +
3*1751**(1/2)*I/16)**(1/3))**(1/2)/2 - (-2*(25/16 +
3*1751**(1/2)*I/16)**(1/3) + 10/(8/(25/16 + 3*1751**(1/2)*I/16)**(1/3) +
2*(25/16 + 3*1751**(1/2)*I/16)**(1/3))**(1/2) - 8/(25/16 +
3*1751**(1/2)*I/16)**(1/3))**(1/2)/2,)]
You can of course reproduce this with your python(3) (idle(3)) installation.
--
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
--
You received this message because you are subscribed to the Google Groups
"sympy-issues" 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-issues?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.