Determinant of a matrix
This functionality does not run in MATLAB.
numeric::det(A, <mode>, <MinorExpansion>, <NoWarning>)
numeric::det(A) returns the determinant of the matrix A.
Without the option Symbolic, all entries of A must be numerical. Numerical expressions such as , etc. are accepted and converted to floats. If symbolic entries are found in the matrix, numeric::det automatically switches to Symbolic issuing a warning.
The option Symbolic should be used if the matrix contains symbolic objects that cannot be converted to floating point numbers.
Note: Matrices A of a matrix domain such as Dom::Matrix(...) or Dom::SquareMatrix(...) are internally converted to arrays over expressions via expr(A). Note that det must be used, when the determinant is to be computed over the component domain. See Example 2. Note that the option Symbolic should be used if the entries cannot be converted to numerical expressions.
Without the option Symbolic, the function is sensitive to the environment variable DIGITS, which determines the numerical working precision.
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)
The 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)
If the option MinorExpansion is used, symbolic entries are accepted, even if the option Symbolic is not specified:
detN := numeric::det(A, MinorExpansion); detS := numeric::det(A, Symbolic, MinorExpansion)
Simplify these results using Simplify:
The following matrix has domain components:
A := Dom::Matrix(Dom::IntegerMod(7))([[6, -1], [1, 6]])
Note that numeric::det computes the determinant of the following matrix:
We demonstrate the use of hardware floats. Hilbert matrices are notoriously ill-conditioned: the computation of the determinant is subject to severe cancellation effects. The following results, both with HardwareFloats as well as with SoftwareFloats, are marred by numerical roundoff:
A := linalg::hilbert(15): float(numeric::det(A, Symbolic)), numeric::det(A, HardwareFloats), numeric::det(A, SoftwareFloats)
One of the flags Hard, HardwareFloats, Soft, SoftwareFloats, or Symbolic
Hard, HardwareFloats, Soft, SoftwareFloats
With Hard (or HardwareFloats), computations are done using fast hardware float arithmetic from within a MuPAD® session. Hard and HardwareFloats are equivalent. With this option, the input data are converted to hardware floats and processed by compiled C code. The result is reconverted to MuPAD floats and returned to the MuPAD session.
With Soft (or SoftwareFloats) computations are dome using software float arithmetic provided by the MuPAD kernel. Soft and SoftwareFloats are equivalent. SoftwareFloats is used by default if the current value of DIGITS is larger than 15 and the input matrix A is not of domain type DOM_HFARRAY.
Compared to the SoftwareFloats used by the MuPAD kernel, the computation with HardwareFloats may be many times faster. Note, however, that the precision of hardware arithmetic is limited to about 15 digits. Further, the size of floating-point numbers may not be larger than approximately 10308 and not smaller than approximately 10- 308.
If no HardwareFloats or SoftwareFloats are requested explicitly, the following strategy is used: If the current value of DIGITS is smaller than 16 or if the matrix A is a hardware float array of domain type DOM_HFARRAY, then hardware arithmetic is tried. If this is successful, the result is returned.
If the result cannot be computed with hardware floats, software arithmetic by the MuPAD kernel is tried.
If the current value of DIGITS is larger than 15 and the input matrix A is not of domain type DOM_HFARRAY, or if one of the options Soft, SoftwareFloats or Symbolic is specified, MuPAD computes the result with its software arithmetic without trying to use hardware floats first.
There may be several reasons for hardware arithmetic to fail:
If neither HardwareFloats nor SoftwareFloats is specified, the user is not informed whether hardware floats or software floats are used.
If HardwareFloats are specified but fail due to one of the reasons above, a warning is issued that the (much slower) software floating-point arithmetic of the MuPAD kernel is used.
Note that HardwareFloats can only be used if all input data can be converted to floating-point numbers.
The trailing digits in floating-point results computed with HardwareFloats and SoftwareFloats may differ.
This option prevents conversion of the input data to floats. With this option, symbolic entries are accepted. It overrides the option HardwareFloats.
With this option, recursive minor expansion along the columns is used. This option may be useful for small matrices with symbolic entries.
This option implies SoftwareFloats.
With this option, symbolic entries are accepted even if the option Symbolic is not used.
By default, the determinant is returned as a floating-point number. With the option Symbolic, an expression is returned.
Without the option Symbolic, QR-factorization of A via Householder transformations is used.
With Symbolic, LU-factorization of A is used.