## `numeric::spectralradius` -- the spectral radius of a matrix

#### Introduction

`numeric::spectralradius``(A, ..)` returns the eigenvalue of the matrix `A` that has the largest absolute value.

#### Call(s)

`numeric::spectralradius(A, x0, n)`

#### Parameters

`A` | - | 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

#### Returns

A 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 Effects

The function is sensitive to the environment variable `DIGITS`, which determines the numerical working precision.

#### Related Functions

`linalg::eigenvalues`, `linalg::eigenvectors`, `numeric::eigenvalues`, `numeric::eigenvectors`, `numeric::singularvalues`, `numeric::singularvectors`

#### Details

- The spectral radius of a matrix with eigenvalues l1,l2,.. is max(abs(l1),abs(l2),..).
- 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: norm(x, 2)=1
- The return value `residue = 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.

- 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 2.

#### Example 1

We 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 2

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: no convergence of vector iteration [numeric::spectral\
          radius]

                  --      +-                           -+      --
                  |  0.0, | 0.7071067812, -0.7071067812 |, 1.0  |
                  --      +-                           -+      --

    >> delete A:

#### Changes

- used to be called `numeric::vonMises`

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000