# Generalized eigenvalue problem

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 close merge delete

Sort by » oldest newest most voted

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)

more