gistlib
You can use the scipy.linalg.solve function to solve an array output in one line in Python. Here's an example:
scipy.linalg.solve
main.pyimport numpy as np from scipy.linalg import solve A = np.array([[2, 1], [1, 1]]) b = np.array([1, 2]) x = solve(A, b) print(x) 129 chars9 lines
import numpy as np from scipy.linalg import solve A = np.array([[2, 1], [1, 1]]) b = np.array([1, 2]) x = solve(A, b) print(x)
This will output the solution x for the linear equation Ax = b.
x
Ax = b
gistlibby LogSnag