## `numeric::det` -- determinant of a matrix

#### Introduction

`numeric::det``(A, ..)` returns the determinant of the matrix `A`.

#### Call(s)

`numeric::det(A <, Symbolic> <, MinorExpansion>)`

#### Parameters

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

#### Options

`Symbolic` | - | prevents conversion of input data to floats
`MinorExpansion` | - | computes the determinant by a minor expansion along the first column

#### Returns

By default the determinant is returned as a floating point number. With the option Symbolic an expression is returned.

#### Side Effects

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

#### Related Functions

`linalg::det`

#### Details

- Without the option Symbolic all entries of `A` must be numerical. Numerical expressions such as `exp(PI), sqrt(2)` etc. are accepted and converted to floats. If symbolic entries are found in the matrix, then `numeric::det` automatically switches to Symbolic, issuing a warning.
- Option Symbolic should be used, if the matrix contains symbolic objects that cannot be converted to floating point numbers.

- 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::det` must be used, when the determinant is to be computed over the component domain. Cf. example 2. Note that the option Symbolic should be used, if the entries cannot be converted to numerical expressions.

#### Option: Symbolic

- This option prevents conversion of the input data to floats. With this option symbolic entries are accepted.

#### Option: MinorExpansion

- With this option recursive minor expansion along the first column is used. This option may be useful for small matrices with symbolic entries.
- With this option symbolic entries are accepted, even if the option Symbolic is not used.

#### Example 1

Numerical matrices can be processed with or without the option Symbolic:

    >> A := array(1..3, 1..3,[[1, 1, I], [1, exp(1), I], [1, 2, 2]]):

    >> numeric::det(A), numeric::det(A, Symbolic)

               3.436563657 - 1.718281829 I, (2 - I) exp(1) - (2 - I)

Option Symbolic must be used, when the matrix has non-numerical entries:

    >> A := array(1..2, 1..2, [[1/(x + 1),  1], [1/(x + 2), PI]]):

    >> numeric::det(A, Symbolic)

                                2 PI - x + x PI - 1
                                -------------------
                                          2
                                   3 x + x  + 2

If the option MinorExpansion is used, then symbolic entries are accepted, even if the option Symbolic is not specified:

    >> numeric::det(A, MinorExpansion),
       numeric::det(A, Symbolic, MinorExpansion)

                       3.141592654     1.0     PI       1
                       ----------- - -------, ----- - -----
                         x + 1.0     x + 2.0  x + 1   x + 2

    >> delete A:

#### Example 2

The following matrix has domain components:

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

                              +-                  -+
                              |  6 mod 7, 6 mod 7  |
                              |                    |
                              |  1 mod 7, 6 mod 7  |
                              +-                  -+

Note that `numeric::det` computes the determinant of the following matrix:

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

                                 +-      -+
                                 |  6, 6  |
                                 |        |, 30.0
                                 |  1, 6  |
                                 +-      -+

The routine `linalg::det` must be used, if the determinant is to be computed over the component domain `Dom::IntegerMod``(7)`:

    >> linalg::det(A)

                                      2 mod 7

    >> delete A:

#### Background

- Without the option Symbolic QR-factorization of A via Householder transformations is used. With Symbolic LU-factorization of A is used.

#### Changes

- Conversion of `Cat::Matrix` objects now uses the method `"expr"` of the matrix domain.

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