       Re: Re: Eigenvalue Problem

• To: mathgroup at smc.vnet.net
• Subject: [mg16965] Re: [mg16908] Re: [mg16894] Eigenvalue Problem
• From: Andrzej Kozlowski <andrzej at tuins.ac.jp>
• Date: Thu, 8 Apr 1999 02:32:54 -0400
• Sender: owner-wri-mathgroup at wolfram.com

```I would like to add a little clarification to my earlier reply and
consider your example more carefully. The main point is that an algebraic
expression  containing radicals which "looks real" may not actually take
real values, and conversely, such an expression that "looks" complex may
actually be real. This is mathematically unavoidable, and not just a
Mathematica problem (as I might have inadvertently suggested in my

Consider for example the very well known case of the roots of the cubic
equation:

In:=
Solve[x^3+b*x+c==0,x]
Out=
1/3                                       3
2  1/3
2    b                  (-27 c + Sqrt[108 b  + 729 c ])
{{x -> -(----------------------------------) + ----------------------------------},
3        2  1/3                     1/3
(-27 c + Sqrt[108 b  + 729 c ])                     3 2
(1 + I Sqrt) b
{x -> --------------------------------------- -
2/3                    3        2  1/3
2    (-27 c + Sqrt[108 b  + 729 c ])
3        2  1/3
(1 - I Sqrt) (-27 c + Sqrt[108 b  + 729 c ])
--------------------------------------------------},
1/3
6 2
(1 - I Sqrt) b
{x -> --------------------------------------- -
2/3                    3        2  1/3
2    (-27 c + Sqrt[108 b  + 729 c ])
3        2  1/3
(1 + I Sqrt) (-27 c + Sqrt[108 b  + 729 c ])
--------------------------------------------------}}
1/3
6 2

We know that one of the roots is always going to be real. Although the
expression for the first root does not contain I, in fact it is not true
that it represents the real root for all values of b and c.  For example
for b=-1, c=2 the first root is complex while the second is real, while
for b=3, c=2 it is the other way round.

l=Eigenvalues[m];

Let's consider the third eigenvalue

In:=
v = l[]
Out=
2      2      2
((1 + I Sqrt) (-252 a  - 3 b  - 3 c )) /
2/3                 2    2      2
(3 2    Power[54 a (80 a  + b  - 5 c ) +
2      2    2      2 2            2      2      2 3
Sqrt[2916 a  (80 a  + b  - 5 c )  + 4 (-252 a  - 3 b  - 3 c ) ], 1/3]) -
1                                    2    2      2
------ (1 - I Sqrt) Power[54 a (80 a  + b  - 5 c ) +
1/3
6 2
2      2    2      2 2            2      2      2 3
Sqrt[2916 a  (80 a  + b  - 5 c )  + 4 (-252 a  - 3 b  - 3 c ) ], 1/3]

This expression looks complex but we know it must always take real values
because the matrix is symmetric.  Looking at it more closely we see that
the expression is a sum g1+g2 of two subexpressions:
In:=
g1=v[];g2=v[];

We know that g1+g2 must be real, because it is the eigenvalue of a
symmetric matrix. But we can also check that the product g1*g2 is also real:
In:=
Simplify[g1*g2]
Out=
1      2    2    2
- (84 a  + b  + c )
3

Now, it is very easy to show that if for two complex numers both their
sum and products are real, then these numbers must be either both real or
they must be conjugate complex numbers. So we see that Mathematica gives
the eigenvalue as the sum of two conjugate complex expressions.

Next, the second eigenvalue looks , more "real", for the expression which
Mathematica gives contains no I's:

In:=
l[]
Out=
1/3        2      2      2
-((2    (-252 a  - 3 b  - 3 c )) /
2    2      2
(3 Power[54 a (80 a  + b  - 5 c ) +
2      2    2      2 2
Sqrt[2916 a  (80 a  + b  - 5 c )  +
2      2      2 3
4 (-252 a  - 3 b  - 3 c ) ], 1/3])) +
1                    2    2      2
------ Power[54 a (80 a  + b  - 5 c ) +
1/3
3 2
2      2    2      2 2
Sqrt[2916 a  (80 a  + b  - 5 c )  +
2      2      2 3
4 (-252 a  - 3 b  - 3 c ) ], 1/3]

But actually the difference is only an illusion! In fact the situation is
just as the previous one: this eigen-value is also the sum of two
conjugate complex expressions (with the same magnitude as in previous case).

I hope this makes the situation clearer.

On Tue, Apr 6, 1999, Andrzej Kozlowski <andrzej at tuins.ac.jp> wrote:

>There is really no error here and probably no way to radically change the
>way Mathematica behaves. In your case Mathematica  gives solutions which
>look like complex expressions, but actually they will always give real
>values when real numbers are substituted for a, b and c (actually this is
>only true up to very tiny imaginary quantities, which appear in numerical
>computations and which can be got rid of using the Chop command.). To see
>this try evaluating the expression
>
>In:=
>m =     {{10 a, 0, b, 0, 0, 0},
>          {0, -2 a, 0, c, 0, 0},
>          {b, 0, -8 a, 0,c, 0},
>          {0, c, 0, -8 a, 0,b},
>          {0, 0, c, 0, -2 a, 0},
>          {0, 0, 0,b, 0, 10 a}};
>
>In:=
>Eigenvalues[m]/.{a->Random[],b->Random[],c->Random[]}//Chop
>Out=
>{3.96643,3.96643,-3.21306,-3.21306,-0.753374,-0.753374}
>
>You will always get real eigenvalues however many times you evaluate
>this. However, I think it is, in general, impossible  in cases such as
>yours  to make sure one obtains  expressions not containing complex
>numbers. The reason is that in order to find the eigenvalues Mathematica
>has to solve the algebraic equation CharacteristicPolynomial[m]==0. To do
>this it uses general algorithms for solving polynomial equations which
>(in the cases in which roots can be expressed by radicals) usually give
>answers involving complex numbers. Even telling Mathematica that a,b, and
>c are real, by using ComplexExpand for example,  won't help much. In
>simple cases Mathematica can tell that a general expression which "looks"
>complex is actually real. For example if
>In:=
>v=I*Sqrt[-a^2]
>
>Then
>In:=
>ComplexExpand[v]
>Out=
>       2
>-Sqrt[a ]
>
>However, consider a somewhat more complicated example
>In:=
>w=I*Sqrt[2a-2-a^2]
>Out=
>                   2
>I Sqrt[-2 + 2 a - a ]
>
>In:=
>ComplexExpand[w]
>Out=
>                2 2 1/4     1                 2
>I ((-2 + 2 a - a ) )    Cos[- Arg[-2 + 2 a - a ]] -
>                            2
>               2 2 1/4     1                 2
> ((-2 + 2 a - a ) )    Sin[- Arg[-2 + 2 a - a ]]
>                           2
>The point is that Mathematica does not notice that -2+2a-a^2 is always
>negative for all real a, so it does not give you the answer: -Sqrt[a^2-2a
>+2].  There is no way, as far as I can tell, to tell Mathematica to do
>this. This sort of problems (and similar ones) will quite often come up
>when Mathematica is solving algebraic equations and I do not think that
>at present there is any general  way to deal with them.
>
>On Mon, Apr 5, 1999, Peter Haesser <phuesser at bluewin.ch> wrote:
>
>>Hello everybody
>>
>>I am trying to solve the eigenvalue problem for the following matrix:
>>
>>m =     {{10 A, 0, B, 0, 0, 0},
>>          {0, -2 A, 0, C, 0, 0},
>>          {B, 0, -8 A, 0, C, 0},
>>          {0, C, 0, -8 A, 0, B},
>>          {0, 0, C, 0, -2 A, 0},
>>          {0, 0, 0, B, 0, 10 A}}
>>
>>which is symmetric. Now mathematica returns some complex eigenvalues
>>which is not
>>possible for a real, symmetric matrix. Can anybody help me ? Maybe the
>>error occurs because
>>mathematica means that the coefficients are complex but how can I make
>>them real ?
>>
>>Thank's in advance for any help.
>>
>>
>>    Peter Huesser
>>
>
>
>Andrzej Kozlowski
>Toyama International University
>JAPAN
>http://sigma.tuins.ac.jp/
>http://eri2.tuins.ac.jp/
>

```

• Prev by Date: Plot
• Next by Date: Multiple Axes
• Previous by thread: Re: Eigenvalue Problem
• Next by thread: Re: Eigenvalue Problem