[SciPy-user] linalg.eigenvalues
Robert Kern
rkern at ucsd.edu
Mon Nov 29 14:32:36 CST 2004
Reik H. Börger wrote:
> Hi,
>
> I encountered the following problem: When giving a symmetric matrix (so
> only real entries) to the function linalg.eig, then it can happen, that
> eigenvalues and eigenvectors are complex.
>
> I admit, that the matrix has almost collinear columns and the imaginary
> part of the eigenvalues/eigenvectors is almost zero (10^-15). But this
> shouldn't happen, since everything in this problem is only real.
You are running into the problems of finite-precision floating point
arithmetic. Values around 1e-15 *are* zero for practical purposes. Since
you know that the output values should be real (up to numerical
precision), you can just take the real part. That is more or less what
Maple is doing.
I also recommend reading "What Every Computer Scientist Should Know
About Floating-Point Arithmetic":
http://docs.sun.com/source/806-3568/ncg_goldberg.html
--
Robert Kern
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the SciPy-user
mailing list