First time here? Check out the FAQ!

Ask Your Question
0

Longer fraction to decimal number

asked 12 years ago

anonymous user

Anonymous

updated 12 years ago

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.

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
5

answered 12 years ago

achrzesz gravatar image

updated 12 years ago

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]
Preview: (hide)
link

Comments

ok, thanks

randomuser gravatar imagerandomuser ( 12 years ago )
2

answered 12 years ago

ppurka gravatar image

updated 12 years ago

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

Preview: (hide)
link

Comments

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.

randomuser gravatar imagerandomuser ( 12 years ago )
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.

DSM gravatar imageDSM ( 12 years ago )

yes, i know

randomuser gravatar imagerandomuser ( 12 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 12 years ago

Seen: 6,254 times

Last updated: Jan 01 '13