gistlib
main.pyimport numpy as np # Coefficients matrix A = np.array([[2, 1, -1, 2], [4, 5, -3, 6], [3, 3, 1, 2], [6, 7, -5, 2], [7, 9, -6, 7]]) # Constants vector B = np.array([2, 3, -1, 4, 5]) # Solve the equation Ax = B X = np.linalg.solve(A, B) print(X) 303 chars17 lines
import numpy as np # Coefficients matrix A = np.array([[2, 1, -1, 2], [4, 5, -3, 6], [3, 3, 1, 2], [6, 7, -5, 2], [7, 9, -6, 7]]) # Constants vector B = np.array([2, 3, -1, 4, 5]) # Solve the equation Ax = B X = np.linalg.solve(A, B) print(X)
gistlibby LogSnag