Description
In this example we compute the eigenvalues of a matrix and display their classes.
i1 : M = matrix {{1,2}, {5,7}}
o1 = | 1 2 |
| 5 7 |
2 2
o1 : Matrix ZZ <-- ZZ
|
i2 : eigenvalues M
o2 = {-.358899}
{8.3589 }
o2 : VerticalList
|
i3 : class \ oo
o3 = {CC}
{CC}
o3 : VerticalList
|
If the matrix is symmetric (over
RR) or Hermitian (over
CC), this information may be provided as an optional argument
Hermitian=>true, so the resulting eigenvalues will be in
RR, not
CC.
i4 : M = matrix {{1,2}, {2,1}}
o4 = | 1 2 |
| 2 1 |
2 2
o4 : Matrix ZZ <-- ZZ
|
i5 : eigenvalues(M, Hermitian=>true)
o5 = {-1}
{3 }
o5 : VerticalList
|
i6 : class \ oo
o6 = {RR}
{RR}
o6 : VerticalList
|
The lapack and eigen libraries are used to compute eigenvectors of real and complex matrices.