numeric::spectralradius
-- the spectral radius of a matrix
Introductionnumeric::spectralradius(A, ..) returns the
eigenvalue of the matrix A that has the largest absolute
value.
Call(s)numeric::spectralradius(A, x0, n)
ParametersA |
- | an m x m matrix of domain type DOM_ARRAY or of category Cat::Matrix |
x0 |
- | a starting vector: a 1-dimensional array or a list of length m |
n |
- | the maximal number of iterations: a positive integer |
ReturnsA list [lambda, x, residue] is returned.
lambda is a floating point approximation of the the
eigenvalue of largest absolute value. The 1-dimensional array
x is a numerical eigenvector corresponding to
lambda. residue is a floating point number
indicating the numerical quality of lambda and
x.
Side
EffectsThe function is sensitive to the environment variable DIGITS, which determines the
numerical working precision.
Related
Functionslinalg::eigenvalues, linalg::eigenvectors,
numeric::eigenvalues, numeric::eigenvectors,
numeric::singularvalues,
numeric::singularvectors
Detailslambda is an approximation of the
corresponding eigenvalue: abs(lambda) is the spectral
radius.x is the corresponding normalized
eigenvector: norm(x, 2)=1residue =
norm(A*x-lambda*x,2) provides an error estimate for the
eigenvalue. For Hermitean matrices this is a rigorous upper bound for
the error abs(lambda-lambda_exact), where
lambda_exact is the exact eigenvalue.numeric::spectralradius implements the power method to
compute the eigenvalue and the associated eigenvector defining the
spectral radius: the vector iteration x.i = (A^i x0)/norm(A^i
x0) ``converges'' towards the eigenspace associated with the
spectral radius. The starting vector x0 is provided by the
second argument of numeric::spectralradius.The iteration does not converge (converges slowly), if the spectral radius is generated by several distinct eigenvalues with the same (similar) absolute value.
DIGITS. If this does
not happen within n iterations, then a warning is issued and
the present values are returned. Cf. example 2.
Example
1We define a starting vector as a 1-dimensional array and allow a maximum of 1000 internal iterations:
>> A := array(1..2, 1..2, [[1, 2], [5, -10]]): x0 := array(1..2, [1, 1]): numeric::spectralradius(A, x0, 1000)
-- +- -+
| -10.84429006, | 0.166500972, -0.9860412904 |,
-- +- -+
--
1.041382012e-11 |
--
Next we use a list to specify a starting vector:
>> A := array(1..2, 1..2, [[I, 3], [3, I]]): numeric::spectralradius(A, [1, 1], 1000)
-- +- -+ --
| 3.0 + 1.0 I, | 0.7071067812, 0.7071067812 |, 0.0 |
-- +- -+ --
>> delete A, x0:
Example
2The following matrix has two distinct eigenvalues 1 and -1 of the same absolute value. The power method must fail.
>> A := array(1..2, 1..2, [[1, 0], [0, -1]]):
We allow a maximum of 1000 internal steps. The call results in a warning. The large residue also indicates that the power method did not converge:
>> numeric::spectralradius(A, [1, 1], 1000)
Warning: no convergence of vector iteration [numeric::spectral\
radius]
-- +- -+ --
| 0.0, | 0.7071067812, -0.7071067812 |, 1.0 |
-- +- -+ --
>> delete A:
numeric::vonMises