# [Maxima] solve(...) and unnecessary complex results

Raymond Toy (RT/EUS) raymond.toy at ericsson.com
Wed Feb 20 15:54:31 CST 2008

```maxima-list at ssteiner.com wrote:
> Dear Maxima experts,
>
> If I make Maxima solve the following example equation it returns results which contain complex parts (%i) but I think the results should be "normal" real numbers.
>
> Example: solve( (0=x^3-4*x+2), x );
>
> Maxima returns:
> [x = (-sqrt(3)*%i/2-1/2)*(3^-(3/2)*sqrt(37)*%i-1)^(1/3)+4*(sqrt(3)*%i/2-\
> 1/2)/(3*(3^-(3/2)*sqrt(37)*%i-1)^(1/3)),x = (sqrt(3)*%i/2-1/2)*(3^-(3/2)*sqrt(\
> 37)*%i-1)^(1/3)+4*(-sqrt(3)*%i/2-1/2)/(3*(3^-(3/2)*sqrt(37)*%i-1)^(1/3)),x = (\
> 3^-(3/2)*sqrt(37)*%i-1)^(1/3)+4/(3*(3^-(3/2)*sqrt(37)*%i-1)^(1/3))]
>
> I think the correct results are -2,214; 0,539; 1,675
> How to make Maxima return these results (real numbers) instead of complicated terms containing complex numbers?
>

solve(x^3-4*x+2,x)\$
rectform(%)\$
trigsimp(%);

[x = -(2*sqrt(3)*sin((atan(sqrt(37)/(3*sqrt(3)))-%pi)/3)
+2*cos((atan(sqrt(37)/(3*sqrt(3)))-%pi)/3))
/sqrt(3),
x = (2*sqrt(3)*sin((atan(sqrt(37)/(3*sqrt(3)))-%pi)/3)
-2*cos((atan(sqrt(37)/(3*sqrt(3)))-%pi)/3))
/sqrt(3),x = 4*cos((atan(sqrt(37)/(3*sqrt(3)))-%pi)/3)/sqrt(3)]

All the numbers are real now, but there are trig functions.  I think
that's unavoidable.

Ray

```