## `linalg::charmat` -- characteristic matrix

#### Introduction

`linalg::charmat``(A, x)` returns the characteristic matrix x*I - A of the n x n matrix A, where I denotes the n x n identity matrix.

#### Call(s)

`linalg::charmat(A, x)`

#### Parameters

`A` | - | a square matrix of a domain of category `Cat::Matrix`
`x` | - | an indeterminate

#### Returns

a matrix of the domain `Dom::Matrix(Dom::DistributedPolynomial([x],R))`, where `R` is the component ring of `A`.

#### Related Functions

`linalg::charpoly`

#### Details

- The component ring of `A` must be a commutative ring, i.e., a domain of category `Cat::CommutativeRing`.
- The characteristic matrix M = x*I - A of A can be evaluated at a point x = u via `evalp(M, x = u)`. See example 2.

#### Example 1

We define a matrix over the rational numbers:

    >> A := Dom::Matrix(Dom::Rational)([[1, 2], [3, 4]])

                                    +-      -+
                                    |  1, 2  |
                                    |        |
                                    |  3, 4  |
                                    +-      -+

and compute the characteristic matrix of A in the variable x:

    >> MA := linalg::charmat(A, x)

                                +-              -+
                                |  x - 1,   -2   |
                                |                |
                                |    -3,  x - 4  |
                                +-              -+

The determinant of the matrix `MA` is a polynomial in x, the characteristic polynomial of the matrix A:

    >> pA := linalg::det(MA)

                                    2
                                   x  - 5 x - 2

    >> domtype(pA)

             Dom::DistributedPolynomial([x], Dom::Rational, LexOrder)

Of course, we can compute the characteristic polynomial of A directly via `linalg::charpoly`:

    >> linalg::charpoly(A, x)

                                    2
                                   x  - 5 x - 2

The result is of the same domain type as the polynomial `pA`.

#### Example 2

We define a matrix over the complex numbers:

    >> B := Dom::Matrix(Dom::Complex)([[1 + I, 1], [1, 1 - I]])

                                +-              -+
                                |  1 + I,   1    |
                                |                |
                                |    1,   1 - I  |
                                +-              -+

The characteristic matrix of `B` in the variable z is:

    >> MB := linalg::charmat(B, z)

                          +-                          -+
                          |  z - (1 + I),      -1      |
                          |                            |
                          |       -1,     z - (1 - I)  |
                          +-                          -+

We evaluate `MB` at z=I and get the matrix:

    >> evalp(MB, z = I)

                                +-               -+
                                |  -1,     -1     |
                                |                 |
                                |  -1, - 1 + 2 I  |
                                +-               -+

Note that this is a matrix of the domain type `Dom::Matrix(Dom::Complex)`:

    >> domtype(%)

                             Dom::Matrix(Dom::Complex)

#### Changes

- used to be called `linalg::charMatrix`

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