Det: Determinant of a Square Matrix

Description Usage Arguments Value Author(s) See Also Examples

View source: R/determinants.R

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

1
2
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 TRUE, print intermediate steps

fractions

logical; if TRUE, try to express non-integers as rational numbers

...

arguments passed to gaussianElimination or Eigen

Value

the determinant of X

Author(s)

John Fox

See Also

det for the base R function

gaussianElimination, Eigen

Other determinants: adjoint, cofactor, minor, rowCofactors, rowMinors

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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")

matlib documentation built on April 4, 2018, 5:03 p.m.