Comment #10 on issue 2362 by [email protected]: subs or N has an issue with
quartic/quadratic root
http://code.google.com/p/sympy/issues/detail?id=2362
The following shows the significant simplification that can occur when
using cancel and expand(complex=True) on an expression:
eq = u**4 - 3*u + 4
ans = solve(eq, simplify=False, check=False)
for r in ans:
... s = eq.subs(u, r)
... print s.count_ops(),
... print cancel(s).count_ops(),
... print cancel(s.expand(complex=1)).count_ops()
...
150 134 29
147 134 29
149 134 29
147 134 29
s
4 + (sqrt(-2*(9/16 + sqrt(42591)*I/144)**(1/3) + 6/sqrt(8/(3*(9/16 +
sqrt(42591)
*I/144)**(1/3)) + 2*(9/16 + sqrt(42591)*I/144)**(1/3)) - 8/(3*(9/16 +
sqrt(42591
)*I/144)**(1/3)))/2 + sqrt(8/(3*(9/16 + sqrt(42591)*I/144)**(1/3)) +
2*(9/16 + s
qrt(42591)*I/144)**(1/3))/2)**4 - 3*sqrt(8/(3*(9/16 +
sqrt(42591)*I/144)**(1/3))
+ 2*(9/16 + sqrt(42591)*I/144)**(1/3))/2 - 3*sqrt(-2*(9/16 +
sqrt(42591)*I/144)
**(1/3) + 6/sqrt(8/(3*(9/16 + sqrt(42591)*I/144)**(1/3)) + 2*(9/16 +
sqrt(42591)
*I/144)**(1/3)) - 8/(3*(9/16 + sqrt(42591)*I/144)**(1/3)))/2
cancel(s.expand(complex=1))
-(-384*cos(atan(sqrt(42591)/81)/3) - 27*sqrt(3) +
512*cos(atan(sqrt(42591)/81)/3
)**3)/(96*cos(atan(sqrt(42591)/81)/3))
This still can't be computed with precision to show it is zero, however:
_.n()
-0.e-141
_._prec
1
--
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.