LinearAlgebra[Modular] - Maple Help

Home : Support : Online Help : Mathematics : Linear Algebra : LinearAlgebra Package : Modular Subpackage : LinearAlgebra/Modular/Determinant

LinearAlgebra[Modular]

 Determinant
 compute the determinant of a square mod m Matrix

 Calling Sequence Determinant(m, A, meth)

Parameters

 m - modulus A - square mod m Matrix meth - (optional) keyword for choice of method

Description

 • The Determinant function returns the mod m determinant of the input square mod m Matrix.
 • The following methods are available:

 REF (default) Compute using standard row-reduction (Row Echelon Form) inplaceREF Compute using standard row-reduction in-place in the input Matrix RET Compute using a Row Echelon Transformation approach inplaceRET Compute using a Row Echelon Transformation in-place in the input Matrix

 • Note that the two inplace methods available will destroy the data in the input Matrix, while the other methods will generate a copy of the Matrix in which to perform the computation.
 • The RET methods are likely to be faster for large matrices, but may fail if the modulus is composite.
 • This command is part of the LinearAlgebra[Modular] package, so it can be used in the form Determinant(..) only after executing the command with(LinearAlgebra[Modular]).  However, it can always be used in the form LinearAlgebra[Modular][Determinant](..).

Examples

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}[\mathrm{Modular}]\right):$
 > $p≔97$
 ${p}{:=}{97}$ (1)
 > $M≔\mathrm{Create}\left(p,4,4,\mathrm{random},\mathrm{float}[8]\right)$
 ${M}{:=}\left[\begin{array}{cccc}{96.}& {62.}& {93.}& {90.}\\ {58.}& {16.}& {76.}& {19.}\\ {7.}& {49.}& {42.}& {78.}\\ {26.}& {19.}& {21.}& {21.}\end{array}\right]$ (2)
 > $\mathrm{Determinant}\left(p,M\right),M$
 ${5}{,}\left[\begin{array}{cccc}{96.}& {62.}& {93.}& {90.}\\ {58.}& {16.}& {76.}& {19.}\\ {7.}& {49.}& {42.}& {78.}\\ {26.}& {19.}& {21.}& {21.}\end{array}\right]$ (3)

With inplaceREF the input Matrix is altered

 > $\mathrm{Determinant}\left(p,M,\mathrm{inplaceREF}\right),M$
 ${5}{,}\left[\begin{array}{cccc}{1.}& {35.}& {4.}& {7.}\\ {0.}& {1.}& {86.}& {38.}\\ {0.}& {0.}& {1.}& {96.}\\ {0.}& {0.}& {0.}& {1.}\end{array}\right]$ (4)

A composite example where the RET method is unsuccessful

 > $M≔\mathrm{Matrix}\left(\left[\left[3,2\right],\left[2,3\right]\right],\mathrm{datatype}=\mathrm{integer}\right)$
 ${M}{:=}\left[\begin{array}{rr}{3}& {2}\\ {2}& {3}\end{array}\right]$ (5)
 > $\mathrm{Determinant}\left(6,M,\mathrm{REF}\right)$
 ${5}$ (6)
 > $\mathrm{Determinant}\left(6,M,\mathrm{RET}\right)$

Note that this is only because this is a case where the row echelon form exists, but the row echelon transform cannot be written in the required form.