Det {matlib} | R Documentation |
Determinant of a Square Matrix
Description
Returns the determinant of a square matrix X
,
computed either by Gaussian elimination, expansion by cofactors, or as the product of the eigenvalues of the matrix.
If the latter, X
must be symmetric.
Usage
Det(
X,
method = c("elimination", "eigenvalues", "cofactors"),
verbose = FALSE,
fractions = FALSE,
...
)
Arguments
X |
a square matrix |
method |
one of '"elimination"' (the default), '"eigenvalues"', or '"cofactors"' (for computation by minors and cofactors) |
verbose |
logical; if |
fractions |
logical; if |
... |
arguments passed to |
Value
the determinant of X
Author(s)
John Fox
See Also
det
for the base R function
Other determinants:
adjoint()
,
cofactor()
,
minor()
,
rowCofactors()
,
rowMinors()
Examples
A <- matrix(c(1,2,3,2,5,6,3,6,10), 3, 3) # nonsingular, symmetric
A
Det(A)
Det(A, verbose=TRUE, fractions=TRUE)
B <- matrix(1:9, 3, 3) # a singular matrix
B
Det(B)
C <- matrix(c(1, .5, .5, 1), 2, 2) # square, symmetric, nonsingular
Det(C)
Det(C, method="eigenvalues")
Det(C, method="cofactors")