help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: error: `eig' undefined near line 5 column 7


From: Geraint Paul Bevan
Subject: Re: error: `eig' undefined near line 5 column 7
Date: Sat, 31 Jul 2004 22:40:52 +0100
User-agent: Mozilla Thunderbird 0.5 (X11/20040306)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Rich Shepard wrote:

| Dmitri,
|
|   While not an octave-specific question, perhaps you can point me toward
| understanding why my results are so different from yours. I used a simple,
| 3x3, matrix from my book:
|
| octave:1> a = load("sample.dat")
| a =
|
|   1.00000  0.33300  0.50000
|   3.00000  1.00000  3.00000
|   2.00000  0.33300  1.00000
|
| octave:2> b = eig(a)
| b =
|
|    3.05294 + 0.00000i
|   -0.02647 + 0.40362i
|   -0.02647 - 0.40362i
|
|   Instead of seeing values as in your example, I have the above. What
is it
| telling me?
|
| Thanks,
|
| Rich
|

The eigenvalues (lambda) of a matrix (A) are the values of lambda that
satisfy (lambda*x = A*x), where lambda is a scalar and I is the identity
matrix. This can be rearranged to give det(lambda*I - A)=0, assuming
that you are not interested in the trivial solution x=0.

In your example, this means that the eigenvalues satisfy

|  lambda-1.0     0.333        0.5    |
|     3.0       lambda-1.0     3.0    | = 0
|     2.0         0.333    lambda-1.0 |

Evaluating the determinent gives

lambda^3 - 3*lambda^2 + 0.002*lambda + 4.4955 = 0


The answer that you are getting tells you the solutions to this equation
and the fact that two of the roots are complex does not mean that there
is anything wrong.


Mathematically, the reason for the complex numbers is that the equation
describes a cubic curve which only crosses the x-axis once. To see the
curve, start gnuplot and type "plot (x*x*x-3*x*x+0.002*x+4.4955)"

If you rewrite the equation as a product of factors using the solutions

(lambda-3.05294)*(lambda+0.02647+0.40362i)*(lambda+0.02647-0.40362*i)=0

and multiply the two terms that contain complex numbers

(lambda-3.05294)*(lambda^2+0.05294*lambda+0.1636)=0

the cause of the complex solutions should become apparent - the solution
to the quadratic second term involves the square root of a negative
number (sqrt(b^2-4ac))=sqrt(-0.652).

As for what the answer is actually telling you, that really depends on
what the original matrix describes. If the original problem described
the equations of motion for a physical system, for example, the negative
complex roots would tell you about a stable mode of oscillation which
the system exhibits.

- --
Geraint Bevan
http://homepage.ntlworld.com/geraint.bevan

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iEYEARECAAYFAkEMEeMACgkQcXV3N50QmNNaBwCfRuiiOqpOiDHHeRjS/qahI748
vpoAni1afZoGYTLp19V7NbHDb5f6IpPd
=rwmf
-----END PGP SIGNATURE-----



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]