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

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

Sort by ยป oldest newest most voted

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

more