Determinantes con R, Python y Octave
4.6 Determinantes con R
La función det()
es la que nos calcula el determinante de cualquier matriz cuadrada en R
Ejemplo 1
Calculemos el determinante de \[A = \begin{pmatrix} 1 & 2\\ 0 & -1 \end{pmatrix}\qquad B = \begin{pmatrix} 1 & 2 & 3\\ 0 & -1 & 5\\ 10 & 2 & -5 \end{pmatrix}\]
A = rbind(c(1,2), c(0,-1))
B = matrix(c(1,2,3,0,-1,5,10,2,-5), nrow = 3, ncol = 3, byrow = TRUE)
det(A)
[1] -1
[1] 125
4.7 Determinantes con Python
La función numpy.linalg.det()
es la que nos calcula el determinante de cualquier matriz cuadrada en Python
Ejemplo 1
Calculemos el determinante de \[A = \begin{pmatrix} 1 & 2\\ 0 & -1 \end{pmatrix}\qquad B = \begin{pmatrix} 1 & 2 & 3\\ 0 & -1 & 5\\ 10 & 2 & -5 \end{pmatrix}\]
import numpy as np
A = np.array([[1, 2], [0,-1]])
B = np.array([[1, 2,3], [0,-1,5], [10,2,-5]])
int(np.linalg.det(A))
-1
125
4.8 Determinantes con Octave
La función det()
es la que nos calcula el determinante de cualquier matriz cuadrada en Octave
Ejemplo 1
Calculemos el determinante de \[A = \begin{pmatrix} 1 & 2\\ 0 & -1 \end{pmatrix}\qquad B = \begin{pmatrix} 1 & 2 & 3\\ 0 & -1 & 5\\ 10 & 2 & -5 \end{pmatrix}\]
detA = -1
detB = 125