Spectral radius of a matrix
This functionality does not run in MATLAB.
numeric::spectralradius(A
, <x_{0}
>, <n
>, <mode
>, <ReturnType = t
>, <NoWarning>)
numeric::spectralradius(A)
returns data corresponding
to the eigenvalue of the matrix A
that has the
largest absolute value.
The spectral radius of a matrix with eigenvalues λ_{i} is max(λ_{i}).
The return value lambda
is an approximation
of the corresponding eigenvalue: abs(lambda)
is
the spectral radius.
The return value x
is the corresponding normalized
eigenvector:
.
The return value provides an error estimate for the eigenvalue. For Hermitian matrices this is a rigorous upper bound for the error lambda  λ_{exact}, where λ_{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
"converges"
towards the eigenspace associated with the spectral radius. The starting
vector x_{0} is
provided by the second argument of numeric::spectralradius
.
If no starting vector is provided by the user, a randomly chosen vector
is used.
Note: The iteration does not converge (converges slowly), if the spectral radius is generated by several distinct eigenvalues with the same (similar) absolute value. 
Internally, the iteration stops, when the approximation of the
eigenvalue becomes stationary within the relative precision given
by DIGITS
.
If this does not happen within n iterations,
then a warning is issued and the present values are returned. Cf. Example 4.
numeric::spectralradius
and numeric::spectralRadius
are
equivalent.
The function is sensitive to the environment variable DIGITS
,
which determines the numerical working precision.
We let the routine choose a random starting vector:
A := matrix(2, 2, [[10, 1], [1, 20]]): numeric::spectralradius(A)
We define a starting vector as a 1dimensional 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)
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)
delete A, x0:
With the default setting of DIGITS
= 10,
the following result is computed using HardwareFloats
.
A := hfarray(1..2, 1..2, [[10^4, 10^4], [50, 60]]): x0 := array(1..2, [1, 1]): numeric::spectralradius(A, x0)
We request SoftwareFloats
in the next call.
Note the difference in the trailing digits:
numeric::spectralradius(A, x0, Soft)
delete DIGITS, A, x0:
The eigenvector that is returned can have various types. If no starting vector is provided, the type of the matrix determines the type of the eigenvector:
A:= array(1..2, 1..2, [[1, 2], [3, 4]]): [l, x, residue]:= numeric::spectralradius(A);
domtype(x)
A:= hfarray(1..2, 1..2, [[1, 2], [3, 4]]): [l, x, residue]:= numeric::spectralradius(A): domtype(x)
A:= matrix(2, 2, [[1, 2], [3, 4]]): [l, x, residue]:= numeric::spectralradius(A): domtype(x)
If a starting vector is provided, its type determines the type of the return vector:
A:= hfarray(1..2, 1..2, [[1, 2], [3, 4]]): x0:= [1, 1]: [l, x, residue]:= numeric::spectralradius(A, x0): domtype(x)
x0:= array(1..2, [1, 1]): [l, x, residue]:= numeric::spectralradius(A, x0): domtype(x)
x0:= hfarray(1..2, [1, 1]): [l, x, residue]:= numeric::spectralradius(A, x0): domtype(x)
x0:= matrix([1, 1]): [l, x, residue]:= numeric::spectralradius(A, x0): domtype(x)
The return type can be requested explicitly:
[l, x, residue] := numeric::spectralradius(A, x0, ReturnType = DOM_LIST): domtype(x)
[l, x, residue] := numeric::spectralradius(A, x0, ReturnType = DOM_HFARRAY): domtype(x)
delete A, x0, l, x, residue:
The 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: There is no convergence of vector iteration. [numeric::spectralradius]
delete A:

An m×m array
of domain type 

A starting vector: a 1dimensional array, or an hfarray, or
a list of length m.
Also 2dimensional arrays ( 

The maximal number of iterations: a positive integer. The default value is 1000. 

One of the flags 

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 

Option, specified as Return the eigenvector associated with the spectral radius as
a vector of domain
type 

Suppresses warnings 
A list [lambda, x, residue]
is returned.
The floatingpoint number lambda
is an approximation
of the eigenvalue of largest absolute value. The vector x
is
a numerical eigenvector corresponding to lambda
. residue
is
a floatingpoint number indicating the numerical quality of lambda
and x
.
If no return type is requested via the ReturnType
option,
the type of the returned vector x
coincides with
the type of the input vector x_{0} (i.e.,
it is a 1dimensional array of type DOM_ARRAY
or DOM_HFARRAY
,
respectively, or a list, or a column
vector of type matrix
or densematrix
. If no starting
vector is specified, the type of x
is determined
by the type of A
.