Ask Your Question

Generalized eigenvalue problem

asked 2021-06-11 10:54:19 +0100

Amrutha gravatar image

I want to find the generalized eigenvalues and eigenvectors of two matrices. But A.eigenmatrix_left(B) is giving the error TypeError: eigenmatrix_left() takes no arguments (1 given). Why is this happening and is there any other way? Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2021-06-11 12:40:46 +0100

Sébastien gravatar image

updated 2021-06-11 12:54:31 +0100

This feature was added recently to SageMath, more precisely, in version 9.2 thanks to Markus Wageringel, see ticket #29243. I believe the error you obtain comes from an earlier version of SageMath.

For example, the generalized eigenvector decomposition is not implemented over the integer ring. A NotImplementedError is raised instead of a TypeError:

sage: A = matrix.identity(2) 
sage: B = matrix([[3, 5], [6, 10]])
sage: A.eigenmatrix_right(B)                                                    
Traceback (most recent call last):
NotImplementedError: generalized eigenvector decomposition is implemented for RDF and CDF, but not for Integer Ring
sage: A.parent()                                                                
Full MatrixSpace of 2 by 2 dense matrices over Integer Ring

As mentionned above in the error message, it works over the real double field RDF and over the complex double field CDF:

sage: A_cdf = A.change_ring(CDF)                                                
sage: A_cdf.parent()                                                            
Full MatrixSpace of 2 by 2 dense matrices over Complex Double Field
sage: B_cdf = B.change_ring(CDF)
sage: A_cdf.eigenmatrix_right(B_cdf)                                            
[0.07692307692307694                 0.0]
[                0.0           +infinity],

[-0.4472135954999579 -0.8574929257125443]
[-0.8944271909999161  0.5144957554275263]

You may prefer to specify the field from the start:

sage: A = matrix.identity(RDF, 2) 
sage: B = matrix(RDF, [[3, 5], [6, 10]])       
sage: A.eigenmatrix_right(B)
sage: A.eigenmatrix_left(B)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2021-06-11 10:54:19 +0100

Seen: 213 times

Last updated: Jun 11 '21