Ask Your Question
0

Longer fraction to decimal number

asked 2013-01-01 06:08:55 +0100

anonymous user

Anonymous

updated 2013-01-01 07:49:02 +0100

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 flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
5

answered 2013-01-01 10:23:33 +0100

achrzesz gravatar image

updated 2013-01-01 10:58:27 +0100

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]
edit flag offensive delete link more

Comments

ok, thanks

randomuser gravatar imagerandomuser ( 2013-01-02 08:31:30 +0100 )edit
2

answered 2013-01-01 07:02:08 +0100

ppurka gravatar image

updated 2013-01-01 07:02:45 +0100

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

edit flag offensive delete link more

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 ( 2013-01-01 07:44:56 +0100 )edit
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 ( 2013-01-01 10:18:59 +0100 )edit

yes, i know

randomuser gravatar imagerandomuser ( 2013-01-02 08:30:34 +0100 )edit

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: 2013-01-01 06:08:55 +0100

Seen: 6,198 times

Last updated: Jan 01 '13