Obtain eigenvalues and eigenvectors in Maple, Mathematica, and MATLAB

Maple

In Maple, in the LinearAlgebra package, the command to obtain eigenvalues and eigenvectors for the matrix A is:

`  Eigenvectors(A)`

For example:

```  > with(LinearAlgebra):
> A:=<1, 2; 6, -1>;
[1     2]
A := [       ]
[6    -1]
> v,e:=Eigenvectors(A);
[  1/2 ]  [    2            2     ]
[13    ]  [---------    ----------]
v, e := [      ], [  1/2           1/2    ]
[   1/2]  [13    - 1    -13    - 1]
[-13   ]  [                       ]
[    1            1     ]
> evalf(v);
[3.605551275 ]
[            ]
[-3.605551275]```

Mathematica

In Mathematica, use:

`  {v, e} = Eigensystem[A] `

For example:

```In:= A = {{1, 2}, {6, -1}}

Out= {{1, 2}, {6, -1}}

In:= {v, e} = Eigensystem[A]

1 - Sqrt       1 + Sqrt
Out= {{-Sqrt, Sqrt}, {{------------, 1}, {------------, 1}}}
6                  6

In:= N[v]

Out= {-3.60555, 3.60555}
```

MATLAB

In MATLAB, use:

`  [e,v] = eig(A)`

For example:

```>> A=[1, 2; 6, -1]
A =
1     2
6    -1
>> [e v]=eig(A)
e =
0.6089   -0.3983
0.7933    0.9172
v =
3.6056         0
0   -3.6056
>> v
v =
3.6056         0
0   -3.6056```

If you have questions about using statistical and mathematical software at Indiana University, contact the UITS Research Applications and Deep Learning team.

Related documents

This is document afko in the Knowledge Base.