Ideally roots() would return RootOf instances, which represent roots of 
polynomials that we don't know how to represent symbolically.  See issue 1579.  
RootOf still needs some work to do this (such as evalf support), but you can 
use RootsOf for polynomials to sort of get this behavior:

>>> list(RootsOf(x**5 + x**4 + x**3 + x**2 + x - 11, x).roots())
[RootOf(x**5 + x**4 + x**3 + x**2 + x - 11, x, index=0), RootOf(x**5 + x**4 + 
x**3 + x**2 + x - 11, x, index=1), RootOf(x**5 + x**4 + x**3 + x**2 + x - 11, 
x, index=2), RootOf(x**5 + x**4 + x**3 + x**2 + x - 11, x, index=3), RootOf(x*
*5 + x**4 + x**3 + x**2 + x - 11, x, index=4)]
>>> list(RootsOf(-11 - 10*x + 2*x**2 + 2*x**3 + 2*x**4 + 2*x**5 + x**6, 
>>> x).exact_roots())
[-1]
>>> list(RootsOf(-11 - 10*x + 2*x**2 + 2*x**3 + 2*x**4 + 2*x**5 + x**6, 
>>> x).formal_roots())
[RootOf(x**6 + 2*x**5 + 2*x**4 + 2*x**3 + 2*x**2 - 10*x - 11, x, index=1), 
RootOf(x**6 + 2*x**5 + 2*x**4 + 2*x**3 + 2*x**2 - 10*x - 11, x, index=2), 
RootOf(x**6 + 2*x**5 + 2*x**4 + 2*x**3 + 2*x**2 - 10*x - 11, x, index=3), 
RootOf(x**6
 + 2*x**5 + 2*x**4 + 2*x**3 + 2*x**2 - 10*x - 11, x, index=4), RootOf(x**6 + 
2*x**5 + 2*x**4 + 2*x**3 + 2*x**2 - 10*x - 11, x, index=5)]

Aaron Meurer
On Jan 11, 2010, at 3:05 PM, cfriedalek wrote:

>> As far as I know there is no symbolical algorithm to determine roots
>> of polynomials of 5th order.
>> 
>> E.g. even wolfram alpha gives just numerical roots:
>> 
>> http://www.wolframalpha.com/input/?i=roots+of+x**5+%2B+x**4+%2B+x**3+...
> 
> I didn't know that. I told you I was a casual user :)
> 
> 
>>> Can't see this being user error but as a casual user it could be. Hope
>>> this helps you fix a bug.
>> 
>> Thanks for reporting it. How do you imagine the fix ---- there seems
>> to be no algorithm to return a symbolic root. So you would expect
>> roots() to automatically return numeric roots?
> 
> For me the main issue is not knowing why the result was an empty
> dictionary. As indicated, in 0.6.5 is was a bug (now fixed) but now
> its not a bug (no algorithm). How to distinguish? I think a simple
> message stating no result available because there is no algorithm to
> do so would be useful and save time and confusion.
> Perhaps provide an optional argument to return numerical roots when no
> symbolic algorithm is available. However I'm inclined to return an
> empty dictionary if no roots available because its easier to test the
> result.
> 
> Thanks for your help, sympy and the education.
> -- 
> 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.
> 
> 

-- 
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.


Reply via email to