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.

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

Leave a comment here

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s