Numerical singular values 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.
Hard | HardwareFloats | Soft | SoftwareFloats>)
numeric::singularvalues(A) returns numerical
singular values of the matrix
The singular values of an m×n matrix A are the p = min(m, n) real nonnegative square roots of the eigenvalues of AH A (for p = n) or of A AH (for p = m). The Hermitian transpose AH is the complex conjugate of the transpose of A.
numeric::singularvalues returns a list of
real singular values [d1,
…, dp] sorted
i.e., d1 ≥
… ≥ dp ≥
All entries of
A must be numerical. Numerical
expressions such as etc.
are accepted and converted to floats. Non-numerical symbolic entries
lead to an error.
A of a matrix domain such as
internally converted to arrays over expressions via
Singular values are approximated with an absolute precision
of where r is
largest singular value of
A. Consequently, large
singular values should be computed correctly to
DIGITS decimal places.
The numerical approximations of small singular values are less accurate.
Singular values may also be computed via
map ( numeric::eigenvalues(
A AH), sqrt ) or
( numeric::eigenvalues( AH A ),
sqrt ), respectively. The use of
the costs of the matrix multiplication. Further, the eigenvalue routine
requires about twice as many
DIGITS to compute small singular values
with the same precision as
Cf. Example 2.
The function is sensitive to the environment variable
which determines the numerical working precision.
The singular values of A and AH coincide:
A := array(1..3, 1..2, [[1, 2*I], [2, 3],[3, sqrt(2)]]):
The Hermitian transpose B = AH:
B := array(1..2, 1..3, [[1, 2, 3], [-2*I, 3, sqrt(2)]]):
delete A, B:
compute singular values:
A := matrix([[1/15, 2/15*I], [PI, 314159265358980/50000000000000*I], [2, 4*I]]):
The Hermitian transpose B = AH can
be computed by the methods
the matrix domain:
B := A::dom::conjugate(A::dom::transpose(A)):
Note that AH A is positive semi-definite and cannot have negative eigenvalues. However, computing small eigenvalues is numerically ill-conditioned, and a small negative value occurs due to roundoff:
Consequently, an (incorrect) imaginary singular value is computed:
We have to increase
DIGITS in order to compute this value
DIGITS := 22: map(numeric::eigenvalues(B*A), sqrt)
numeric::singularvalues, the standard
DIGITS := 10: numeric::singularvalues(A, SoftwareFloats)
delete A, B:
We demonstrate the use of hardware floats. Hilbert
matrices are notoriously ill-conditioned: the computation of
the small singular values is subject to severe roundoff effects. In
the following results, both with
well as with
SoftwareFloats, the small singular
values are dominated by numerical roundoff. Consequently, the results
HardwareFloats differ from those with with
A := linalg::hilbert(15): numeric::singularvalues(A, HardwareFloats); numeric::singularvalues(A, SoftwareFloats)
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
For ill-conditioned matrices, the result is subject to roundoff
errors. The results returned with
Ordered list of real floating-point values.
The code implements standard numerical algorithms from the Handbook of Automatic Computation by Wilkinson and Reinsch.