Determinantes con R

Ejemplo 1

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)

Ejemplo 1

det(A)
[1] -1
det(B)
[1] 125

Determinantes con Python

Ejemplo 1

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]])

Ejemplo 1

int(np.linalg.det(A))
-1
int(np.linalg.det(B))
125

Determinantes con Octave

Ejemplo 1

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}\]

A = [1, 2; 0,-1]; B = [1, 2,3; 0,-1,5; 10,2,-5];
detA = det(A)
detB = det(B)
detA = -1
detB =  125