Ask Your Question

Revision history [back]

You should better provide concrete examples so that we understand your question.

Let us first create a 3 by 3 random matrix:

sage: m = random_matrix(QQ,3,3) ; m
[  -2    1   -2]
[   0    0   -2]
[   0    0 -1/2]

We can find its eigenvalues:

sage: L = m.eigenvalues() ; L
[0, -1/2, -2]

Then, if the interesting one is -1/2, let us find its position in the list:

sage: L.index(-1/2)
1

According to the documentatnion of m.eigenvectors_right, we can find the list of rignt eigenvectors as a list of tuples "(e,V,n) where e is the eigenvalue, V is a list of eigenvectors forming a basis for the corresponding right eigenspace, and n is the algebraic multiplicity of the eigenvalue.":

sage: m.eigenvectors_right()
[(0, [
  (1, 2, 0)
  ], 1), (-1/2, [
  (1, 3, 3/4)
  ], 1), (-2, [
  (1, 0, 0)
  ], 1)]

The are ordered in the same way as with m.eigenvalues(), so we can find the tuple associated to the eigenvalue -1/2 as follows;

sage: m.eigenvectors_right()[L.index(-1/2)]
(-1/2, [
 (1, 3, 3/4)
 ], 1)

We want an eigenvector, so the second entry (with index 1) of this tuple is interesting:

sage: m.eigenvectors_right()[L.index(-1/2)][1]
[
(1, 3, 3/4)
]

SInce we do only want one eigenvector (not the whole basis), let us pick the first entry (with index 0):

sage: m.eigenvectors_right()[L.index(-1/2)][1][0]
(1, 3, 3/4)