1import numpy as np
2
3a = np.array([[6,2,-5], [3,3,-2], [7,5,-3]])
4b = np.array([13,13,26])
5x = np.linalg.solve(a, b)
6
7print(x)
1import numpy as np
2A = np.array([[8, 3, -2], [-4, 7, 5], [3, 4, -12]])
3b = np.array([9, 15, 35])
4x = np.linalg.solve(A, b)
5x
6
1>>> a = np.array([[3,1], [1,2]])
2>>> b = np.array([9,8])
3>>> x = np.linalg.solve(a, b)
4>>> x
5array([2., 3.])
6