determinant() function in R Language is a generic function that returns separately the modulus of the determinant, optionally on the logarithm scale, and the sign of the determinant.
Syntax: determinant(x, logarithm = TRUE, …)
Parameters:
x: matrix
logarithm: if TRUE (default) return the logarithm of the modulus of the determinant
Example 1:
# R program to illustrate # determinant function # Initializing a matrix with # 3 rows and 3 columns x <- matrix(c(3, 2, 6, -1, 7, 3, 2, 6, -1), 3, 3) # Getting the matrix representation x # Calling the determinant() function determinant(x) |
chevron_right
filter_none
Output:
[, 1] [, 2] [, 3]
[1, ] 3 -1 2
[2, ] 2 7 6
[3, ] 6 3 -1
$modulus
[1] 5.220356
attr(, "logarithm")
[1] TRUE
$sign
[1] -1
attr(, "class")
[1] "det"
Example 2:
# R program to illustrate # determinant function # Initializing a matrix with # 2 rows and 2 columns x <- matrix(c(1, 2, 3, 4), 2, 2) # Getting the matrix representation x # Calling the determinant() function determinant(x, logarithm = FALSE) |
chevron_right
filter_none
Output:
[, 1] [, 2]
[1, ] 1 3
[2, ] 2 4
$modulus
[1] 2
attr(, "logarithm")
[1] FALSE
$sign
[1] -1
attr(, "class")
[1] "det"
Recommended Posts:
- Getting the Determinant of the Matrix in R Programming - det() Function
- Getting a Matrix of number of columns in R Programming - col() Function
- Getting a Matrix of number of rows in R Programming - row() Function
- Check if the Object is a Matrix in R Programming - is.matrix() Function
- Convert a Data Frame into a Numeric Matrix in R Programming - data.matrix() Function
- Convert an Object into a Matrix in R Programming - as.matrix() Function
- Transform the Scaled Matrix to its Original Form in R Programming - Using Matrix Computations
- Getting and Setting Length of the Vectors in R Programming - length() Function
- Getting Match of an Element within a Vector in R Programming - charmatch() Function
- Getting class of different data types in R Programming - class() Function
- Getting type of different data types in R Programming - typeof() Function
- Getting String Representation of the given Date and Time Object in R Programming - strftime() Function
- Getting Kernel Density Estimates in R Programming - density() Function
- Return a Matrix with Lower Triangle as TRUE values in R Programming - lower.tri() Function
- Compute Choleski factorization of a Matrix in R Programming - chol() Function
- Get or Set Dimensions of a Matrix in R Programming - dim() Function
- Calculate the Sum of Matrix or Array columns in R Programming - colSums() Function
- Calculate the Mean of each Column of a Matrix or Array in R Programming - colMeans() Function
- Calculate the cross-product of a Matrix in R Programming - crossprod() Function
- Calculate the cross-product of the Transpose of a Matrix in R Programming - tcrossprod() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

