ARCHIVED: Obtain eigenvalues and eigenvectors in Maple, Mathematica, and MATLAB

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

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[1]:= A = { {1, 2}, {6, -1} }                                             

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

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

                                  1 - Sqrt[13]       1 + Sqrt[13]
Out[2]= { {-Sqrt[13], Sqrt[13]}, { {------------, 1}, {------------, 1} } }
                                       6                  6

In[3]:= N[v]                                                              

Out[3]= {-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.

This is document afko in the Knowledge Base.
Last modified on 2023-05-09 14:37:42.