# [Maxima] cubic with three real roots

Edwin Woollett woollett at charter.net
Sun Mar 23 16:37:37 CDT 2008

```The cubic polynomial ex has three real roots,

(%i1) fpprintprec : 8\$
(%i2) display2d : false\$
(%i3) ex : 8*x^3 - 68*x^2 + 160*x - 95\$
(%i4) allroots(ex);
(%o4) [x = 0.904363,x = 2.6608754,x = 4.9347613]

but solve returns solutions involving %i.  In a
previous mailing list example dealing with a fifth order polynomial
the suggestion was to use radcan, but my attempts so far are futile.

here is just solve output:

(%i5) rx : solve(ex);
(%o5) [x = (-sqrt(3)*%i/2-1/2)*(3^-(3/2)*sqrt(16585)*%i/16+151/432)^(1/3)
+49*(sqrt(3)*%i/2-1/2)/(36*(3^-(3/2)*sqrt(16585)*%i/16+151/432)
^(1/3))+17/6,
etc.]

here is radcan acting on solve output:
(%o6) [x = -((sqrt(3)*%i+1)*(9*sqrt(5)*sqrt(31)*sqrt(107)*%i+151*sqrt(3))
^(2/3)
-34*2^(1/3)*3^(1/6)
*(9*sqrt(5)*sqrt(31)*sqrt(107)*%i+151*sqrt(3))^(1/3)
-49*2^(2/3)*3^(5/6)*%i+49*2^(2/3)*3^(1/3))
/(12*2^(1/3)*3^(1/6)
*(9*sqrt(5)*sqrt(31)*sqrt(107)*%i+151*sqrt(3))^(1/3)),
etc  ]

here is radcan(...), algebraic acting on solve output:

(%o7) [x = ((3*sqrt(3)*sqrt(5)*sqrt(31)*sqrt(107)*%i+151)^(2/3)
*((3*2^(1/3)*sqrt(3)*sqrt(5)*sqrt(31)*sqrt(107)+151*2^(1/3)*sqrt(3))
*%i
+9*2^(1/3)*sqrt(5)*sqrt(31)*sqrt(107)-151*2^(1/3))
+(-4802*2^(2/3)*sqrt(3)*%i-4802*2^(2/3))
*(3*sqrt(3)*sqrt(5)*sqrt(31)*sqrt(107)*%i+151)^(1/3)+326536)
/115248,
etc ]

here is rootscontract acting on last output

(%i8) rx3 : rootscontract(rx2);
(%o8) [x = ((906*sqrt(-49755)-424994)^(1/3)
*((3*2^(1/3)*sqrt(49755)+151*2^(1/3)*sqrt(3))*%i
+9*2^(1/3)*sqrt(16585)-151*2^(1/3))
+(3*sqrt(-49755)+151)^(1/3)*(-4802*sqrt(-3)*4^(1/3)-4802*4^(1/3))
+326536)
/115248,
etc ]

Any other tricks available?

Ted Woollett
```