[Numpy-discussion] Wrong Eigenvalue (Approximation?)

Gabriel Mihalache mihalache at gmail.com
Sun May 16 00:03:58 EDT 2010


Hello, all! I'm new to Numpy and Python so please tolerate by
ignorance on this but I'm having problems with some weird behavior.
Consider the session:

>>> import numpy as np
>>> import numpy.linalg as la
>>> x = np.array([[0.3, 0.2, 0.5], [0.2, 0.1, 0.7], [0.9, 0.05, 0.05]]).transpose()
>>> esystem = la.eig(x)
>>> esystem[0]
array([ 1.  , -0.3 , -0.25])
>>> esystem[0][0]
1.0000000000000004

The eigenvalue should be 1 exactly. In fact, later on I want to be able to do

np.where(x == 1)

which fails.
The way I set up the matrix, I know for sure that there must be one
eigenvalue exactly equal to 1.

Any help is greatly appreciated!
This is all on

Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit
(Intel)] on win32

Regards,
Gabriel



More information about the NumPy-Discussion mailing list