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) returns numerical
eigenvalues and eigenvectors of the matrix
All entries of the matrix must be numerical. Numerical expressions such as etc. are accepted and converted to floats. Non-numerical symbolic entries lead to an error.
The eigenvalues are sorted by
X provides the eigenvectors: the i-th
X is a numerical eigenvector corresponding
to the eigenvalue
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,
X is not necessarily invertible.
The list of residues res = [res1, res2, …] provides some control over the quality of the numerical spectral data. The residues are given by
where xi is
the normalized eigenvector (the i-th
X) associated with the numerical eigenvalue di.
For Hermitian matrices, resi provides
an upper bound for the absolute error of di.
With the option
NoResidues, the computation
of the residues is suppressed, the returned value is
If no return type is specified via the option
= t, the domain type of the eigenvector matrix
on the type of the input matrix
The eigenvectors of a dense matrix of type
returned as a dense matrix of type
the ring of expressions.
For all other matrices of category
Cat::Matrix, the eigenvectors
are returned as matrices of type
the ring of MuPAD® expressions. This includes input matrices
Eigenvalues are approximated with an absolute precision
where r is
the spectral radius of
For a numerical algorithm, it is not possible to distinguish
between badly separated distinct eigenvalues and multiple eigenvalues.
For this reason,
only eigenvalues are to be computed.
The function is sensitive to the environment variable
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):
Hilbert matrices are Hermitian, i.e., computing the spectral data is a numerically stable process. This is confirmed by the small residues:
the input as a matrix of type
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:
We extract an eigenvector from the matrix
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 ill-conditioned 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]])
the spectral data of the following matrix:
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
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:
Compared to the
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:
The trailing digits in floating-point 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
[d, X, res]. The list
d = [d1,
d2, …] contains the numerical
eigenvalue. The i-th
column of the matrix
X is the eigenvector associated
with the eigenvalue
The list of residues
res = [res1,
res2, …] provides error estimates
for the numerical eigenvalues.
The routine implements standard numerical algorithms from the Handbook of Automatic Computation by Wilkinson and Reinsch.