Ask Your Question
0

Longer fraction to decimal number

asked 2012-12-31 23:08:55 -0500

anonymous user

Anonymous

updated 2013-01-01 00:49:02 -0500

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 03:23:33 -0500

achrzesz gravatar image

updated 2013-01-01 03:58:27 -0500

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 01:31:30 -0500 )edit
2

answered 2013-01-01 00:02:08 -0500

ppurka gravatar image

updated 2013-01-01 00:02:45 -0500

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 00:44:56 -0500 )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 03:18:59 -0500 )edit

yes, i know

randomuser gravatar imagerandomuser ( 2013-01-02 01:30:34 -0500 )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: 2012-12-31 23:08:55 -0500

Seen: 2,017 times

Last updated: Jan 01 '13