Hello all:
I'm trying to import Numeric to fix the eigenvalues bug for real and complex
matrices. The following function should do it but it has problems I
think with the
eigenvalues line. Am I importing something wrong?
- David Joyner
++++++++++++++++++++++
def numeric_eigenvalues(A):
"""
Returns the eigenvalues of a real matrix A using numeric.
EXAMPLES:
sage: MS = MatrixSpace(RR,4,4)
sage: A = MS([[1,2,3,4],[4,3,2,1],[4,5,6,7],[5,4,3,5]])
sage: numeric_eigenvalues(A)
"""
import Numeric
#from Numeric.Numeric import array,eigenvalues,reshape
n = len(A[0])
AN = Numeric.reshape(A.list(),(n,n))
lambdas = Numeric.eigenvalues(AN)
return lambdas
sage: MS = MatrixSpace(RR,4,4)
sage: A = MS([[1,2,3,4],[4,3,2,1],[4,5,6,7],[5,4,3,5]])
sage: numeric_eigenvalues(A)
---------------------------------------------------------------------------
<type 'exceptions.AttributeError'> Traceback (most recent call last)
/home/wdj/sagefiles/sage-1.4.1.2/<ipython console> in <module>()
/home/wdj/sagefiles/sage-1.4.1.2/<ipython console> in numeric_eigenvalues(A)
<type 'exceptions.AttributeError'>: 'module' object has no attribute
'eigenvalues'
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---