1
$\begingroup$

I am new to Mathematica and there is a behavior that I don't understand. When I insert the code:

Solve[-(x - 2)^3 + 10 x - 10 == 0, x]

I obtain:

{{x -> 2 + (2 5^(2/3))/(3 (9 + I Sqrt[39]))^(1/3) + (5 (9 + I Sqrt[39]))^(1/3)/3^(2/3)},  
{x -> 2 - (5^(2/3) (1 + I Sqrt[3]))/  
  (3 (9 + I Sqrt[39]))^(1/3) - ((1 - I Sqrt[3]) (5 (9 + I Sqrt[39]))^(1/3))/(2 3^(2/3))},  
{x ->  2 - (5^(2/3) (1 - I Sqrt[3]))/
  (3 (9 + I Sqrt[39]))^(1/3) - ((1 + I Sqrt[3]) (5 (9 + I Sqrt[39]))^(1/3))/(2 3^(2/3))}}

These are complex roots, but this polynomial has real roots, that in fact I can correctly find when I use Root. Why are this complex roots being displayed? Are these supposed to be approximations?

Edit:

Thanks for the answer, now I understand better the underlying process and that Solve is in fact finding exact solutions. The "approximate zero" in the imaginary component comes from the numerical solution to the exact root, not from Solve.

It can removed by using Chop as described here.

$\endgroup$
3
  • 1
    $\begingroup$ It's using radicals ... $\endgroup$ Jul 16, 2013 at 20:06
  • $\begingroup$ You can find a bit of related info on this in the ToRadicals doc page. $\endgroup$ Jul 16, 2013 at 20:46
  • 3
    $\begingroup$ These are not complex roots. For why they are given in a form that uses sqrt(-1), look up "casus irreducibilis". $\endgroup$ Jul 19, 2013 at 20:30

2 Answers 2

6
$\begingroup$

Solve - strange results when numericalized

You need to be aware of, when solving cubical polynomials and the polynomial has three roots and does not factor, the answer returned by Mathematica will contain, when numericalized, a term like verySmallNumber *I.

In your case you could increase the precision:

Solve[-(x - 2)^3 + 10 x - 10 == 0, x] // N[#, 22] &

==> {{x->5.577089445136461440525+0.*10^-22 I},
     {x->-0.4236221399906988397916+0.*10^-23 I},
     {x->0.8465326948542373992666+0.*10^-23 I}}

which is in fact a zero with finite accuracy * I.

NRoots gives in this case purely real solutions:

NRoots[-(x - 2)^3 + 10 x - 10 == 0, x]

==> x == -0.423622 || x == 0.846533 || x == 5.57709

In Mathematica irreducible higher order polynomials will be solved for in Root-objects.

Edit 1

Let's spin that further. Let's just take the first root of your solution:

root1=2+(2 5^(2/3))/(3 (9+I Sqrt[39]))^(1/3)+(5 (9+I Sqrt[39]))^(1/3)/3^(2/3);

If we add now an approximate real zero we will get a result in approximate real part:

root1 + 0.

==> 5.57709 -1.66533*10^-16 

Which is one of the roots and a second part acting as approximative zero.

$\endgroup$
3
  • $\begingroup$ Well, root1 + 0. is no different from root1 // N that you did earlier :) $\endgroup$
    – rm -rf
    Jul 16, 2013 at 20:40
  • $\begingroup$ i know. i wanted to show how to deal with factors of the form "very small number" * I ... $\endgroup$
    – Stefan
    Jul 16, 2013 at 20:44
  • $\begingroup$ I found here how to remove the approximate zero using Chop $\endgroup$
    – papirrin
    Jul 17, 2013 at 6:24
7
$\begingroup$

As belisarius notes, the result is using radicals. Using FullSimplify or Cubics -> False gives you Root objects, which are just as exact and equivalent, but again, not exactly what you need (see this answer by Artes for more on how to work with them).

In this case, you can use ComplexExpand to get a purely real solution:

Solve[-(x - 2)^3 + 10 x - 10 == 0, x] // ComplexExpand

$\endgroup$
1
  • $\begingroup$ Good complement to the answer. I would upvote it if I had enough reputation :-( $\endgroup$
    – papirrin
    Jul 17, 2013 at 6:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.