Solve the system of equations 3 * x0 + x1 = 9 and x0 + 2 * x1 = 8:
a = np.array([[3,1], [1,2]]) b = np.array([9,8]) x = np.linalg.solve(a, b) x array([ 2., 3.])
Check if the solution is correct:
np.allclose(np.dot(a, x), b) True
Solve the system of equations 3 * x0 + x1 = 9 and x0 + 2 * x1 = 8:
a = np.array([[3,1], [1,2]]) b = np.array([9,8]) x = np.linalg.solve(a, b) x array([ 2., 3.])
Check if the solution is correct:
np.allclose(np.dot(a, x), b) True