Newbie question about solving a polynom



Gunter Konigsmann question see in
http://www.math.utexas.edu/pipermail/maxima/2013/033586.html

 Exact solving of polynomial equations(Casus irreducibilis).
A.Domarkas

 For exact solving polynomial equations  I  define

(%i1)
solvet(eq,x):=block([spr,k,maperror,mapprint],
/* Copyright (C) 2013 Aleksas Domarkas */
maperror:false, mapprint:false,
spr:solve(eq,x), rectform(%%),
if freeof(sin,%%) then return(sort(%%)) else
makelist(x=map(polarform,rhs(spr[k])),k,1,length(spr)),
rectform(%%),
trigsimp(%%),
sort(%%))$

 Example 1.
(%i2) eq1:x^3-3*x+1=0$
(%i3) solvet(eq1,x);
(%o3) [x=2*cos((2*%pi)/9),x=2*cos((4*%pi)/9),x=2*cos((8*%pi)/9)]
(%i4) float(%);
(%o4) [x=1.532088886237956,x=0.34729635533386,x=-1.879385241571817]
(%i5) allroots(eq1);
(%o5) [x=0.34729635533386,x=1.532088886237956,x=-1.879385241571817]

 Example 2.
(%i6) eq2:x^3-7*x-7=0$
(%i7) solvet(eq2,x);
(%o7)
[x=(2*sqrt(7)*cos(atan(1/3^(3/2))/3))/sqrt(3),x=(2*sqrt(7)*cos((atan(1/3^(3/2))-2*%pi)/3))/sqrt(3),x=(2*sqrt(7)*cos((atan(1/3^(3/2))+2*%pi)/3))/sqrt(3)]
(%i8) float(%)$ sort(%);
(%o9) [x=-1.692021471630095,x=-1.356895867892209,x=3.048917339522306]
(%i10) allroots(eq2)$ sort(%);
(%o11) [x=-1.692021471630096,x=-1.356895867892209,x=3.048917339522306]

 Example 3.
http://www.trans4mind.com/personal_development/mathematics/polynomials/cardanoMethodExamples.htm
(%i12) eq3:1000*x^3-1254*x^2-496*x+191=0$
(%i13) solvet(eq3,x);
(%o13)
[x=(2*sqrt(255043)*cos(atan((500*sqrt(110466006911))/(30449487*sqrt(6)))/3)+209*sqrt(3))/(500*sqrt(3)),
x=(2*sqrt(255043)*cos((atan((500*sqrt(110466006911))/(30449487*sqrt(6)))-2*%pi)/3)+209*sqrt(3))/(500*sqrt(3)),
x=(2*sqrt(255043)*cos((atan((500*sqrt(110466006911))/(30449487*sqrt(6)))+2*%pi)/3)+209*sqrt(3))/(500*sqrt(3))]
(%i14) float(%)$ sort(%);
(%o15) [x=-0.50033136443491,x=0.25453205895146,x=1.49979930548345]
(%i16) allroots(eq3)$ sort(%);
(%o17) [x=-0.50033136443491,x=0.25453205895146,x=1.49979930548345]

 Example 4.
(%i18) eq4:x^6+6*x^5-2*x^4-46*x^3+96*x-48=0;
(%o18) x^6+6*x^5-2*x^4-46*x^3+96*x-48=0
(%i19) solvet(eq4,x);
(%o19)
[x=2,x=-sqrt(5)-1,x=sqrt(5)-1,x=2^(3/2)*cos(atan(sqrt(7))/3)-2,x=2^(3/2)*cos((atan(sqrt(7))-2*%pi)/3)-2,x=2^(3/2)*cos((atan(sqrt(7))+2*%pi)/3)-2]
(%i20) float(%)$ sort(%);
(%o21)
[x=-4.261802245259972,x=-3.23606797749979,x=-2.339876886623182,x=0.60167913188315,x=1.23606797749979,x=2.0]
(%i22) allroots(eq4)$ sort(%);
(%o23)
[x=-4.261802245259974,x=-3.236067977499787,x=-2.339876886623183,x=0.60167913188315,x=1.236067977499792,x=2.0]

 Problem for Maple, Mathematica, WolframAlpha users:
get exact real solutions of equations eq1, eq2, eq3, eq4.
I think the Maxima better solves these equations.

best
Aleksas Domarkas