numeric::det
-- determinant of a
matrixnumeric::det
(A, ..)
returns the
determinant of the matrix A
.
numeric::det(A <, Symbolic> <,
MinorExpansion>)
A |
- | a square matrix of domain type DOM_ARRAY or of category Cat::Matrix |
Symbolic |
- | prevents conversion of input data to floats |
MinorExpansion |
- | computes the determinant by a minor expansion along the first column |
By default the determinant is returned as a floating point number. With the option Symbolic an expression is returned.
Without the option Symbolic the function is
sensitive to the environment variable DIGITS
, which determines the
numerical working precision.
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.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.
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:
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:
Cat::Matrix
objects now uses the method
"expr"
of the matrix domain.