## Sage: Eigenstuff

This help sheet is very useful!

Suppose we want to find the eigenvalues and eigenvectors of the matrix
$A = \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}$
We can find the eigenvalues using

A = matrix([[2,1],[1,2]])
A.eigenvalues()


A list of eigenvalues, with corresponding eigenvectors and multiplicities, is obtained from

A = matrix([[2,1],[1,2]])
A.eigenvectors_right()


The code

A = matrix([[2,1],[1,2]])
A.eigenmatrix_right()


produces two matrices: the first is a diagonal matrix with eigenvalues down the diagonal; the second is the transition matrix where the column vectors are eigenvectors. One way to use this function is

A = matrix([[2,1],[1,2]])
D,P = A.eigenmatrix_right()
show(P)


which designates the diagonal matrix to be $D$ and the transition matrix to be $P$.

This entry was posted in Sage, Uncategorized. Bookmark the permalink.