MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Help with Root function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79541] Re: Help with Root function
  • From: dimitris <dimmechan at yahoo.com>
  • Date: Sat, 28 Jul 2007 05:48:06 -0400 (EDT)
  • References: <f89q55$5nu$1@smc.vnet.net><f8ceo3$28h$1@smc.vnet.net>

On 27     , 12:43, jeremito <jerem... at gmail.com> wrote:
> Thank you all who offered the solution to this problem.  The answer
> is:
>
> Eigenvalues[B]//ToRadicals
>
> How simple, if you know how to do it.  My follow-up question is:
>
> How could I (or anyone) have found that on their own?  I searched in
> the documentation, but couldn't find it until I knew what to search
> for.
>
> Thanks again,
> Jeremy
>
> On Jul 26, 5:39 am, jeremito <jerem... at gmail.com> wrote:
>
>
>
> > I am trying to find the eigenvalues of a 3x3 matrix with non-numeric
> > elements.  This requires finding the roots of cubic polynomials.
> > Mathematica can do this, but I know how to interpret its output.  For
> > example
>
> > In[1]:= B = {{a, 1, 1}, {1, b, 1}, {1, 1, c}}
>
> > Out[1]= {{a, 1, 1}, {1, b, 1}, {1, 1, c}}
>
> > In[2]:= Eigenvalues[B]
>
> > Out[2]= {Root[-2 + a + b + c -
> >     a b c + (-3 + a b + a c + b c) #1 + (-a - b - c) #1^2 + #1^3 &,
> >   1], Root[-2 + a + b + c -
> >     a b c + (-3 + a b + a c + b c) #1 + (-a - b - c) #1^2 + #1^3 &,
> >   2], Root[-2 + a + b + c -
> >     a b c + (-3 + a b + a c + b c) #1 + (-a - b - c) #1^2 + #1^3 &,
> >   3]}
>
> > How can I get Mathematica to give me the full answer?  I know it is
> > long and ugly, but at least I can do something with it.  I can't do
> > anything with what it gives me now.  Does that make sense?
> > Thanks,
> > Jeremy-                               -
>
> -                               -

Are you sure you look carefully the help broswer?

For version prior to 6 the following command will take you to
the Root page documentation page.

FrontEndExecute[{HelpBrowserLookup["RefGuide", "Root"]}]

There we read:

... See also: Solve, RootReduce, ToRadicals, RootSum, Extension,
Algebraics...

BTW, compare the numerical approximations below:

In[118]:=
Clear["Global`*"]

In[163]:=
B = {{a, 1, 1}, {1, b, 1}, {1, 1, c}}

Out[163]=
{{a, 1, 1}, {1, b, 1}, {1, 1, c}}

In[164]:=
eigs = Eigenvalues[B]

Out[164]=
{Root[-2 + a + b + c - a*b*c - 3*#1 + a*b*#1 + a*c*#1 + b*c*#1 -
a*#1^2 - b*#1^2 - c*#1^2 + #1^3 & , 1],
  Root[-2 + a + b + c - a*b*c - 3*#1 + a*b*#1 + a*c*#1 + b*c*#1 -
a*#1^2 - b*#1^2 - c*#1^2 + #1^3 & , 2],
  Root[-2 + a + b + c - a*b*c - 3*#1 + a*b*#1 + a*c*#1 + b*c*#1 -
a*#1^2 - b*#1^2 - c*#1^2 + #1^3 & , 3]}

In[165]:=
roos = eigs /. Thread[{a, b, c} -> {1, 2, 3}]

Out[165]=
{Root[-2 + 8*#1 - 6*#1^2 + #1^3 & , 1], Root[-2 + 8*#1 - 6*#1^2 + #1^3
& , 2], Root[-2 + 8*#1 - 6*#1^2 + #1^3 & , 3]}

In[166]:=
N[roos]

Out[166]=
{0.32486912943335394, 1.460811127189111, 4.214319743377534}

In[167]:=
N[roos, 30]

Out[167]=
{0.324869129433353929110378201849939519191967472323`30.,
1.460811127189110883474124097301479991900112890458`30.,
  4.214319743377535187415497700848580488907919637219`30.}

In[168]:=
ras = ToRadicals[eigs] /. Thread[{a, b, c} -> {1, 2, 3}]

Out[168]=
{2 + 4/((1/2)*(54 + 6*I*Sqrt[111]))^(1/3) + (1/3)*((1/2)*(54 +
6*I*Sqrt[111]))^(1/3),
  2 - (2*(1 + I*Sqrt[3]))/((1/2)*(54 + 6*I*Sqrt[111]))^(1/3) -
(1/6)*(1 - I*Sqrt[3])*((1/2)*(54 + 6*I*Sqrt[111]))^(1/3),
  2 - (2*(1 - I*Sqrt[3]))/((1/2)*(54 + 6*I*Sqrt[111]))^(1/3) -
(1/6)*(1 + I*Sqrt[3])*((1/2)*(54 + 6*I*Sqrt[111]))^(1/3)}

In[161]:=
N[ras]

Out[161]=
{4.214319743377535 - 1.6653345369377348*^-16*I, 0.3248691294333541 -
4.440892098500626*^-16*I,
  1.4608111271891107 + 6.661338147750939*^-16*I}

In[169]:=
N[ras, 30]

Out[169]=
{4.214319743377535187415497700848580488907919637212`30.15051499783199
+ 0``29.525787515084698*I,
  0.324869129433353929110378201849939519191967472326`30.15051499783199
+ 0``30.638806553195906*I,
  1.460811127189110883474124097301479991900112890459`30.15051499783199
+ 0``29.985920929551387*I}

Root objects are more preferable for such issues (notice the imaginary
round off error of the radicals).

Also due to the Abel impossibilty theorem, for equations of degree
five and high (apart from special cases)
no roots in terms of elementary functions (radicals, trigonometrics
etc) can be obtained. So you
can't avoid the presence of Root objects! The theory behind them is
one of the most elegant theories
in mathematics and having them nicely implemented in Mathematica is a
really gift!

Dimitris




  • Prev by Date: Storing matrices
  • Next by Date: Fwd: combined front end and html conversion problems
  • Previous by thread: Re: Re: Help with Root function
  • Next by thread: Workbench 1.1