Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mathematica FullSimplify[Sqrt[5+2 Sqrt[6]]] yields Sqrt[2]+Sqrt[3] but FullSimplify[-Sqrt[5+2 Sqrt[6]]] is not simplified, why?

I was playing with the (beautiful) polynomial x^4 - 10x^2 + 1. Look what happens:

 In[46]:= f[x_] := x^4 - 10x^2 + 1
          a = Sqrt[2];
          b = Sqrt[3];
          Simplify[f[ a + b]]
          Simplify[f[ a - b]]
          Simplify[f[-a + b]]
          Simplify[f[-a - b]]
 Out[49]= 0
 Out[50]= 0
 Out[51]= 0
 Out[52]= 0

 In[53]:= Solve[f[x] == 0, x]
 Out[53]= {{x->-Sqrt[5-2 Sqrt[6]]},{x->Sqrt[5-2 Sqrt[6]]},{x->-Sqrt[5+2 Sqrt[6]]},{x->Sqrt[5+2 Sqrt[6]]}}
 In[54]:= Simplify[Solve[f[x] == 0, x]]
 Out[54]= {{x->-Sqrt[5-2 Sqrt[6]]},{x->Sqrt[5-2 Sqrt[6]]},{x->-Sqrt[5+2 Sqrt[6]]},{x->Sqrt[5+2 Sqrt[6]]}}
 In[55]:= FullSimplify[Solve[f[x] == 0, x]]
 Out[55]= {{x->Sqrt[2]-Sqrt[3]},{x->Sqrt[5-2 Sqrt[6]]},{x->-Sqrt[5+2 Sqrt[6]]},{x->Sqrt[2]+Sqrt[3]}}

Sqrt[5-2 Sqrt[6]] is equal to Sqrt[3]-Sqrt[2].
However, Mathematica's FullSimplify does not simplify Sqrt[5-2 Sqrt[6]].

Question: Should I use other more specialized functions to algebraically solve the equation? If so, which one?

like image 369
nilo de roock Avatar asked Dec 19 '11 21:12

nilo de roock


2 Answers

Indeed, Solve doesn't simplify all roots to the max:

enter image description here

A FullSimplify postprocessing step simplifies two roots and leaves two others untouched:

enter image description here

Same initially happens with Roots:

enter image description here

Strange enough, now FullSimplify simplifies all roots:

enter image description here

The reason for this is, I assume, that for the default ComplexityFunction some of the solutions written above in nested radicals are in a sense simpler than the others.

BTW FunctionExpand knows how to deal with those radicals:

enter image description here

enter image description here

like image 64
Sjoerd C. de Vries Avatar answered Oct 05 '22 21:10

Sjoerd C. de Vries


FullSimplify[ Solve[x^4-10x^2+1==0,x]
, 
  ComplexityFunction -> 
   (StringLength[ToString[
      InputForm[#1]]] & )]

gives

{{x -> Sqrt[2] - Sqrt[3]}, {x -> -Sqrt[2] + Sqrt[3]}, {x -> -Sqrt[2] -
 Sqrt[3]}, {x -> Sqrt[2] + Sqrt[3]}}
like image 36
Rolf Mertig Avatar answered Oct 05 '22 21:10

Rolf Mertig