Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created May 31, 2018 12:44
Show Gist options
  • Save Fhernd/ffe57e3f8ea3ee42758adb4b7f769193 to your computer and use it in GitHub Desktop.
Save Fhernd/ffe57e3f8ea3ee42758adb4b7f769193 to your computer and use it in GitHub Desktop.
Operaciones en álgebra lineal. OrtizOL.
import numpy as np
from numpy import linalg
matriz = np.matrix([[-2, 3, -5], [2, 3, 5], [7, 11, 13]])
print(matriz)
print('')
# Transpuesta:
print(matriz.T)
print('')
# Inversa:
print(linalg.inv(matriz))
print('')
# Producto por vector:
vector = np.matrix([[2], [3], [5]])
print(vector)
print(matriz * vector)
print('')
# Determinante:
print(linalg.det(matriz))
print('')
# Valores propios:
print(linalg.eigvals(matriz))
print('')
# Solución de sistemas de ecuaciones:
print(linalg.solve(matriz, vector))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment