Finding Eigenvalues and Eigenvectors in Octave

Description

The eig function in Octave calculates eigenvectors and eigenvalues. The following cell calculates the eigenvalues of the matrix

(1)
\begin{align} A = \begin{pmatrix} 1 & 3 & 3 \\ 3 & -3 & 1 \\ 4 & 1 & 4 \end{pmatrix}. \end{align}

Sage Cell

Code

A=[1 3 3; 3 -3 1; 4 1 4];
eig(A)


Options

Option

In order to obtain the eigenvectors, you need to provide two variables for the answer. The column of the matrix V are the eigenvectors. The eigenvalues are now in the diagonal matrix D. Notice that $VDV^{-1}$ recovers the original matrix.
.

Code

A=[1 3 3; 3 -3 1; 4 1 4];
[V, D] = eig(A)
V*D*inv(V)


Primary Tags:

Secondary Tags: