## `numeric::eigenvalues` -- numerical eigenvalues of a matrix

#### Introduction

`numeric::eigenvalues``(A)` returns numerical eigenvalues of the matrix `A`.

#### Call(s)

`numeric::eigenvalues(A)`

#### Parameters

`A` | - | a numerical square matrix of domain type `DOM_ARRAY` or of category `Cat::Matrix`

#### Returns

an ordered list of numerical eigenvalues

#### Side Effects

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

#### Related Functions

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

#### Details

- All entries of `A` must be numerical. Numerical expressions such as `exp(PI), sqrt(2)` etc. are accepted and converted to floats. Non-numerical symbolic entries lead to an error.

- Matrices `A` of a matrix domain such as `Dom::Matrix``(..)` or `Dom::SquareMatrix``(..)` are internally converted to arrays over expressions via `A::dom::expr(A)`. Note that `linalg::eigenvalues` must be used, when the eigenvalues are to be computed over the component domain. Cf. example 2.

- The eigenvalues are sorted by `numeric::sort`.

- Eigenvalues are approximated with an absolute precision of 10^(-DIGITS)*r, where r is the spectral radius of `A` (i.e., r is the maximum of the absolute values of the eigenvalues). Consequently, large eigenvalues should be computed correctly to `DIGITS` decimal places. The numerical approximations of the small eigenvalues are less accurate.

#### Example 1

We compute the eigenvalues of the 3x3 Hilbert matrix:

    >> numeric::eigenvalues(linalg::hilbert(3))

                    [0.002687340356, 0.1223270659, 1.408318927]

Precision goal and working precision are set by `DIGITS`:

    >> A := array(1..3, 1..3,
                  [[   I     ,     PI   ,  exp(1)  ],
                   [   2     ,  10^100  ,    1     ],
                   [10^(-100), 10^(-100), 10^(-100)]
                  ]):

    >> DIGITS := 10: numeric::eigenvalues(A)

                            [1.0 I, 5.0e-101, 10.0e99]

Note that small eigenvalues may be influenced by round-off. We increase the working precision. The previous numerical eigenvalue 5.0*10^(-101) is improved to (1.0+2.718...*I)*10^(-100):

    >> DIGITS := 200: eigenvals := numeric::eigenvalues(A):

    >> DIGITS := 10: eigenvals

          [- 6.283185307e-100 + 1.0 I, 1.0e-100 + 2.718281829e-100 I,

             1.0e100 + 2.031919862e-102 I]

    >> delete A, eigenvals:

#### Example 2

The following matrix has domain components:

    >> A := Dom::Matrix(Dom::IntegerMod(7))(
           [[6, -1, 4], [0,  3, 3], [0,  0, 3]])

                          +-                           -+
                          |  6 mod 7, 6 mod 7, 4 mod 7  |
                          |                             |
                          |  0 mod 7, 3 mod 7, 3 mod 7  |
                          |                             |
                          |  0 mod 7, 0 mod 7, 3 mod 7  |
                          +-                           -+

Note that `numeric::eigenvalues` computes the eigenvalues of the following matrix:

    >> A::dom::expr(A), numeric::eigenvalues(A)

                          +-         -+
                          |  6, 6, 4  |
                          |           |
                          |  0, 3, 3  |, [3.0, 3.0, 6.0]
                          |           |
                          |  0, 0, 3  |
                          +-         -+

If the eigenvalues are to be computed over the component domain `Dom::IntegerMod``(7)`, then `linalg::eigenvalues` should be used:

    >> linalg::eigenvalues(A, Multiple)

                           [[6 mod 7, 1], [3 mod 7, 2]]

    >> delete A:

#### Background

- The function implements standard numerical algorithms from the Handbook of Automatic Computation by Wilkinson and Reinsch.

#### Changes

- Conversion of `Cat::Matrix` objects now uses the method `"expr"` of the matrix domain. Triangular matrices are now processed numerically.

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