# Longer fraction to decimal number Anonymous

After solve( x^3+8*x^2+x+10 , x ) I get

x = (2/9*sqrt(3)*sqrt(1355) - 611/27)^(1/3) + 61/9/(2/9*sqrt(3)*sqrt(1355) - 611/27)^(1/3) - 8/3

Now how to show this as decimal? float(x) and R = RealField(50); R(x) doesn't seem to work.

edit retag close merge delete

Sort by » oldest newest most voted

The problem is that for Sage (-1)^(1/3) is complex (and you have negative numbers in parentheses)

CC((-1)^(1/3))
0.500000000000000 + 0.866025403784439*I


If you need the real solution you can use (-abs(a))^(1/3)=-(abs(a))^(1/3), a-real

y=-abs(2/9*sqrt(3)*sqrt(1355) - 611/27)^(1/3) -61/9/abs(2/9*sqrt(3)*sqrt(1355) - 611/27)^(1/3) - 8/3
RR(y)
-8.03053921870339


If your equation is polynomial and you need the real roots you can also use roots()

reset()
(x^3+8*x^2+x+10).roots(multiplicities=false,ring=RR)
[-8.03053921870339]

more

Use N(x), or x.n().

more

Wired, it prints 0.0152696093516960 - 1.11580160984665*I but the GNOME's "gcalctool" default calculator gives -8.030539219. Also from the plot in geogebra I know that it's -8.03.

1

@randomuser: you're solving a cubic, so there are three roots. When you did solve( x^3+8*x^2+x+10 , x ) , you got three answers. They're 0.015 +/- 1.116 I and -8.03.