Ask Your Question
0

Why don't WolframAlpha's and Sage's answer match?

asked 2015-01-20 21:52:54 -0500

Phoenix gravatar image

updated 2015-01-21 02:11:46 -0500

Consider this input to WolframAlpha,

solve [ 0 = x^4 - 6*x^2 - 8*x*cos( (2*pi )/5 ) - 2*cos( (4*pi)/5) - 1 ]

The solutions it gives are,

{x == (1 - Sqrt[5])/2 || x == (3 + Sqrt[5])/2 || x == (-2 - Sqrt[2 (5 - Sqrt[5])])/2 || x == (-2 + Sqrt[2 (5 - Sqrt[5])])/2, {-0.618034, 2.61803, -2.17557, 0.175571}}

But the same equation on sage gives the roots,

sage: h(x) = x^4 - 6*x^2 - 8*x*cos( (2*pi )/5 ) - 2*cos( (4*pi)/5) - 1 
sage: h(x).solve(x)
[x == -1/2*sqrt(-2*sqrt(5) + 10) - 1, x == 1/2*sqrt(-2*sqrt(5) + 10) - 1,
x == -1/2*sqrt(2*sqrt(5) + 6) + 1, x == 1/2*sqrt(2*sqrt(5) + 6) + 1]

It seems that the first two roots given by WolframAlpha differ from the last two roots given by Sage.

Why?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2015-01-21 04:33:01 -0500

tmonteil gravatar image

updated 2015-01-21 07:43:55 -0500

First, it seems that the solutions provided by Sage are correct:

sage: S = [s.rhs() for s in h(x).solve(x)]
sage: S
[-1/2*sqrt(-2*sqrt(5) + 10) - 1,
 1/2*sqrt(-2*sqrt(5) + 10) - 1,
 -1/2*sqrt(2*sqrt(5) + 6) + 1,
 1/2*sqrt(2*sqrt(5) + 6) + 1]
sage: [h(s).full_simplify() for s in S]
[0, 0, 0, 0]

Then, it seems that the numerical values are the same as the ones provided by wolfram:

sage: [RR(s) for s in S]
[-2.17557050458495, 0.175570504584946, -0.618033988749895, 2.61803398874989]

Actually, they are not written the same way but they are equal:

sage: bool(-1/2*sqrt(-2*sqrt(5) + 10) - 1 == (-2 - sqrt(2*(5 - sqrt(5))))/2)
True
sage: bool(1/2*sqrt(-2*sqrt(5) + 10) - 1  == (-2 + sqrt(2*(5 - sqrt(5))))/2)
True
sage: bool(-1/2*sqrt(2*sqrt(5) + 6) + 1 == (1 - sqrt(5))/2)
True
sage: bool(1/2*sqrt(2*sqrt(5) + 6) + 1 == (3 + sqrt(5))/2)
True

So, without having to dig into its closed source code, we can see that wolfram is not completely wrong in that case :D That said, it is not advised to use alpha releases for production :P

edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-01-20 21:52:54 -0500

Seen: 468 times

Last updated: Jan 21 '15