[SciPy-user] Proper Use of NumPy's eig()

Robert Kern robert.kern at gmail.com
Tue Feb 27 15:27:37 EST 2007


Rich Shepard wrote:
>    I start the module with
>  	from numpy import linalg
> 
> and I need to find the principal Eigenvector of the matrix E. But, when I
> try
> 
>  	eigE = eig(E)
> 
> python responds "NameError: global name 'eig' is not defined."
> 
>    Do I need another module from NumPy, should I explicitly cast E to a
> matrix, or am I calling the function incorrectly?

eigE = linalg.eig(E)

Importing modules like that doesn't put their contents into the current
namespace; rather it puts the module object itself into the namespace.

  http://docs.python.org/tut/node8.html

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco



More information about the SciPy-User mailing list