Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
1  
It's using radicals ... –  belisarius Jul 16 '13 at 20:06
    
You can find a bit of related info on this in the ToRadicals doc page. –  Sjoerd C. de Vries Jul 16 '13 at 20:46
1  
These are not complex roots. For why they are given in a form that uses sqrt(-1), look up "casus irreducibilis". –  Daniel Lichtblau Jul 19 '13 at 20:30

2 Answers 2

up vote 4 down vote accepted

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.

share|improve this answer
    
Well, root1 + 0. is no different from root1 // N that you did earlier :) –  rm -rf Jul 16 '13 at 20:40
    
i know. i wanted to show how to deal with factors of the form "very small number" * I ... –  Stefan Jul 16 '13 at 20:44
    
I found here how to remove the approximate zero using Chop –  papirrin Jul 17 '13 at 6:24

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

share|improve this answer
    
Good complement to the answer. I would upvote it if I had enough reputation :-( –  papirrin Jul 17 '13 at 6:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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