Hi

thanks for your earlier answers.

I quite often do this:

sage:  solve(x^3 + 10*x^2+11*x+8==0,x)
[snip]

Then I realize that the analytic solution is rather complicated.
So  I want a numerical approximation.

I tried this:

roots = solve(x^3+10*x^2+11*x+8==0,x)
sage: roots
[x == -1/2*(1/3*sqrt(926) - 613/27)^(1/3)*(I*sqrt(3) + 1) -
1/18*(-67*I*sqrt(3) + 67)/(1/3*sqrt(926) - 613/27)^(1/3) - 10/3, x ==
-1/2*(1/3*sqrt(926) - 613/27)^(1/3)*(-I*sqrt(3) + 1) -
1/18*(67*I*sqrt(3) + 67)/(1/3*sqrt(926) - 613/27)^(1/3) - 10/3, x ==
(1/3*sqrt(926) - 613/27)^(1/3) + 67/9/(1/3*sqrt(926) - 613/27)^(1/3) -
10/3]
sage: N(roots)


but this returns an error ("too many values to unpack").


The best I can do is

N(roots[1].rhs())

but this is just one at a time.  How do I make N() operate on all of roots?
Or is there a much neater way of accomplishing the same thing?

cheers

rksh





-- 
Robin Hankin
Uncertainty Analyst
hankin.ro...@gmail.com

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to