Numerical eigenvalues and eigenvectors of a matrix
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
numeric::eigenvectors(A
, options
)
numeric::eigenvectors(A)
returns numerical
eigenvalues and eigenvectors of the matrix A
.
All entries of the matrix must be numerical. Numerical expressions such as etc. are accepted and converted to floats. Nonnumerical symbolic entries lead to an error.
The eigenvalues are sorted by numeric::sort
.
The matrix X
provides the eigenvectors: the ith
column of X
is a numerical eigenvector corresponding
to the eigenvalue d_{i}
. Each
column is either zero or normalized to the Euclidean length 1.0.
For matrices with multiple eigenvalues and an insufficient number
of eigenvectors, some of the eigenvectors may coincide or may be zero,
i.e., X
is not necessarily invertible.
The list of residues res = [res_{1}, res_{2}, …] provides some control over the quality of the numerical spectral data. The residues are given by
,
where x_{i} is
the normalized eigenvector (the ith
column of X
) associated with the numerical eigenvalue d_{i}.
For Hermitian matrices, res_{i} provides
an upper bound for the absolute error of d_{i}.
With the option NoResidues
, the computation
of the residues is suppressed, the returned value is NIL
.
If no return type is specified via the option ReturnType
= t
, the domain type of the eigenvector matrix X
depends
on the type of the input matrix A
:
The eigenvectors of a dense matrix of type Dom::DenseMatrix()
are
returned as a dense matrix of type Dom::DenseMatrix()
over
the ring of expressions.
For all other matrices of category Cat::Matrix
, the eigenvectors
are returned as matrices of type Dom::Matrix()
over
the ring of MuPAD^{®} expressions. This includes input matrices A
of
type Dom::Matrix(...)
, Dom::SquareMatrix(...)
, Dom::MatrixGroup(...)
etc.
Note:
Matrices 
Note:
Eigenvalues are approximated with an absolute precision
of
,
where r is
the spectral radius of 
Note:
For a numerical algorithm, it is not possible to distinguish
between badly separated distinct eigenvalues and multiple eigenvalues.
For this reason, 
Use numeric::eigenvalues
if
only eigenvalues are to be computed.
The function is sensitive to the environment variable DIGITS
,
which determines the numerical working precision.
We compute the spectral data of the 2×2 Hilbert matrix:
A := linalg::hilbert(2)
[d, X, res] := numeric::eigenvectors(A):
The eigenvalues:
d
The eigenvectors:
X
Hilbert matrices are Hermitian, i.e., computing the spectral data is a numerically stable process. This is confirmed by the small residues:
res
The routine linalg::hilbert
provides
the input as a matrix of type Dom::Matrix()
. Consequently,
the eigenvectors also consist of such a matrix. For further processing,
we convert the list of eigenvalues to a diagonal matrix:
d := matrix(2, 2, d, Diagonal):
We reconstruct the matrix from its spectral data:
X*d*X^(1)
We extract an eigenvector from the matrix X
and
doublecheck its numerical quality:
eigenvector1 := X::dom::col(X, 1); norm(A*eigenvector1  d[1, 1]*eigenvector1)
delete A, d, X, res, eigenvector1:
We demonstrate a numerically illconditioned case. The following matrix has only one eigenvector and cannot be diagonalized. Numerically, the zero vector is returned as the second column of the eigenvector matrix:
A := array(1..2, 1..2, [[5, 1], [4, 1]]): DIGITS := 6: numeric::eigenvectors(A)
delete A, DIGITS:
The following matrix has domain components:
A := Dom::Matrix(Dom::IntegerMod(7))([[6, 1], [0, 3]])
Note that numeric::eigenvectors
computes
the spectral data of the following matrix:
expr(A)
numeric::eigenvectors(A, NoResidues)
The routine linalg::eigenvectors
should
be used if the spectral data are to be computed over the component
domain Dom::IntegerMod
(7)
:
linalg::eigenvectors(A)
delete A:
We demonstrate the use of hardware floats. The following matrix
is degenerate: it has rank 1.
For the double eigenvalue 0,
different base vectors of the corresponding eigenspace are returned
with HardwareFloats
and SoftwareFloats
,
respectively:
A := array(1..3, 1..3, [[1, 2, 3], [2, 4, 6], [3*10^12, 6*10^12, 9*10^12]]): [d1, X1, res1] := numeric::eigenvectors(A, HardwareFloats): d1, X1
[d2, X2, res2] := numeric::eigenvectors(A, SoftwareFloats): d2, X2
delete A, d1, X1, res1, d2, X2, res2:

A numerical matrix of domain type 

With With Compared to the If no If the result cannot be computed with hardware floats, software arithmetic by the MuPAD kernel is tried. If the current value of There may be several reasons for hardware arithmetic to fail:
If neither If Note that The trailing digits in floatingpoint results computed with
 

Suppresses the computation of error estimates If no error estimates are required, this option may be used
to suppress the computation of the residues The alternative option name  

Option, specified as Return the eigenvectors as a matrix of domain type  

Suppresses warnings 
List [d, X, res]
. The list d = [d_{1},
d_{2}, …]
contains the numerical
eigenvalue. The ith
column of the matrix X
is the eigenvector associated
with the eigenvalue d_{i}
.
The list of residues res = [res_{1},
res_{2}, …]
provides error estimates
for the numerical eigenvalues.
The routine implements standard numerical algorithms from the Handbook of Automatic Computation by Wilkinson and Reinsch.