Assume that we have the following three equations:
We define A and B as follows:
The solution is as follows:
The related Python code is as follows:
>>>import scipy as sp >>>import numpy as np >>>A=sp.mat('[1 2 5; 2 5 1; 2 3 8]') >>>b = sp.mat('[10;8;5]') >>>A.I*b Matrix([-22.45, 10.09, 2.45] >>>np.linalg.solve(A,b) # offer the same solution