Message Boards Message Boards

0
|
11847 Views
|
9 Replies
|
0 Total Likes
View groups...
Share
Share this post:
GROUPS:

Solve for third degree polynomial

Posted 10 years ago

Hello,

The following 3rd degree polynomial has 3 real roots. All roots can be written as multiple of Cosines. Using Solve, I cannot obtain all three roots expressed in a simple manner. Any idea ? Thanks for your help.

Solve[x^3-3x-1==0,x]

Pierre

POSTED BY: Pierre Henrotay
9 Replies

The usage of Re is a pitty, so it took 138 attempts only to avoid that

In[138]:= (FullSimplify[Re[#]] + I FullSimplify[Im[#]]) & /@ (
  TrigReduce[ExpToTrig[ComplexExpand[ToRadicals[#, Cubics -> True]]]] & /@ (
     Last[Last[#]] & /@ Solve[x^3 - 3 x - 1 == 0, x]))

Out[138]= {2 Cos[\[Pi]/9], -Cos[\[Pi]/9] - Sqrt[3] Sin[\[Pi]/9], 
 1/2 (-Cos[\[Pi]/9] - 2 Sin[\[Pi]/18] + Sqrt[3] Sin[\[Pi]/9])}

the thing is, that FullSimplify recognizes the Root object back; it does so no longer if it sees the real and imaginary parts in splendid isolation ...


Having understood that, one can do of course better:

In[142]:= (FullSimplify[Re[#]] + I FullSimplify[Im[#]])& /@ (
             ComplexExpand[ToRadicals[Last[Last[#]], Cubics -> True]]& /@ Solve[x^3 - 3 x - 1 == 0, x])

Out[142]= {2 Cos[\[Pi]/9], -Cos[\[Pi]/9] - Sqrt[3] Sin[\[Pi]/9], 
 1/2 (-Cos[\[Pi]/9] - 2 Sin[\[Pi]/18] + Sqrt[3] Sin[\[Pi]/9])}

My conclusion so far is that Mathematica returns an inconsistent answer.

Not at all. But it is for very good reasons (Galois) Root-centered in polynomial algebra. You have to break that on your own.

POSTED BY: Udo Krause
Posted 10 years ago

@Pierre If you are ok with numerical solution, here it is..

NSolve[x^3 - 3 x - 1 == 0, x,10]
{{x -> -1.532088886}, {x -> -0.3472963553}, {x -> 1.879385242}}
POSTED BY: Okkes Dulgerci
In[64]:= Solve[x^3 - 3 x - 1 == 0, x, Reals]

Out[64]= {{x -> Root[-1 - 3 #1 + #1^3 &, 1]}, {x ->  Root[-1 - 3 #1 + #1^3 &, 2]}, {x -> Root[-1 - 3 #1 + #1^3 &, 3]}}

In[67]:= N[{{x -> Root[-1 - 3 #1 + #1^3 &, 1]}, {x -> Root[-1 - 3 #1 + #1^3 &, 2]}, {x -> Root[-1 - 3 #1 + #1^3 &, 3]}}]

Out[67]= {{x -> -1.53209}, {x -> -0.347296}, {x -> 1.87939}}
In[68]:= {{x -> -1.532088886237956`}, {x -> -0.3472963553338607`}, {x \-> 1.8793852415718169`}}
POSTED BY: Simon Cadrin

Mathematica has a rigorous, general way to deal with this.

roots = x /. Solve[x^3 - 3 x - 1 == 0, x, Cubics -> False]
{Root[-1 - 3 #1 + #1^3 &, 1], Root[-1 - 3 #1 + #1^3 &, 2], 
 Root[-1 - 3 #1 + #1^3 &, 3]}

Now, that looks like it really hasn't accomplished anything. In this particular case, the reduction to Root[] objects is trivial. However, Root[] objects are the best general-purpose representation of roots.

Root[] objects with precise coefficients are precise numbers. Mathematica can extract their properties:

Map[Element[#, Reals] &, roots]
{True, True, True}

Mathematica can also rapidly compute numeric approximations of them, without parasitic imaginary parts:

N[roots, 100]
{-1.532088886237956070404785301110833347871664914160790491708090569284310777713749447056458553361096987, 
-0.3472963553338606977034332535386295920007513543681387744724827562641316442780294708430332263147991480, 
1.879385241571816768108218554649462939872416268528929266180573325548442421991778917899491779675896135}
POSTED BY: John Doty
Posted 10 years ago

Well done Bill and Okkes ! Not that simple...

What puzzles me most is that Mathematica is not able to perform the job by itself. Let me clarify : after ComplexExpand // Fullsimplify, one root returned is real (2Cos[Pi/9]); another is real as well (it could be further simplified as it is 2Cos[7*PI/9], but ok). And the third persists in showing a complex value, although its imaginary part must be zero (this is a 3rd order polynomial with real coefficients). My conclusion so far is that Mathematica returns an inconsistent answer. Of course, this being due to the sequence of operations, whereby the maths of the original problem is forgotten.

POSTED BY: Pierre Henrotay
Posted 10 years ago
ExpToTrig[ToRadicals[Root[-1 - 3 #1 + #1^3 &, 1]]] // Re
POSTED BY: Okkes Dulgerci
Posted 10 years ago

Thank you for pointing out my misunderstanding. I saw Cubics false in the details and assumed that was the default value.

In[1]:= FullSimplify[x /. Solve[x^3 - 3 x - 1 == 0, x]]

Out[1]= {2 Cos[\[Pi]/9], Root[-1 - 3 #1 + #1^3 &, 1], -Cos[\[Pi]/9] + Sqrt[3] Sin[\[Pi]/9]}

In[2]:= ExpToTrig[ToRadicals[Root[-1 - 3 #1 + #1^3 &, 1]]]

Out[2]= -(1/2) Cos[\[Pi]/9] + 1/2 I Sqrt[3] Cos[\[Pi]/9] - Cos[(2 \[Pi])/9] - 1/2 I Sin[\[Pi]/9] - 1/2 Sqrt[3] Sin[\[Pi]/9] - I Sin[(2 \[Pi])/9]

FullSimplify only the complex terms

In[3]:= -(1/2) Cos[\[Pi]/9] + FullSimplify[1/2 I Sqrt[3] Cos[\[Pi]/9] - 1/2 I Sin[\[Pi]/9] - I Sin[(2 \[Pi])/9]] - Cos[(2 \[Pi])/9] - 1/2 Sqrt[3] Sin[\[Pi]/9]

Out[3]= -(1/2) Cos[\[Pi]/9] - Cos[(2 \[Pi])/9] - 1/2 Sqrt[3] Sin[\[Pi]/9]
POSTED BY: Bill Simpson
Posted 10 years ago

Thanks. But Cubics->True is apparently the default for Solve (but not for Reduce). The first two roots are addressed by: Solve[x^3 - 3 x - 1 == 0, x] // ComplexExpand // FullSimplify

But the third one is the one which causes me trouble indeed. I tried various combinations (ComplexExpand, FullSimplify etc..). No success so far.

POSTED BY: Pierre Henrotay
Posted 10 years ago

In the help page for Solve click on Details and Options and read all the extra documentation for Solve.

In that find that including the option Cubics->True will give you what you want

Solve[x^3 - 3 x - 1 == 0, x, Cubics -> True]

Using FullSimplify on the result will translate two out of the three into trig form.

Using ExpToTrig and FullSimplify in various ways on parts of the third one can get it into trig form.

POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract