numpy.linalg.solve()


Advertisements

The numpy.linalg.solve() function gives the solution of linear equations in the matrix form.

Considering the following linear equations −

x + y + z = 6

2y + 5z = -4

2x + 5y - z = 27

They can be represented in the matrix form as −

$$\begin{bmatrix}1 & 1 & 1 \\0 & 2 & 5 \\2 & 5 & -1\end{bmatrix} \begin{bmatrix}x \\y \\z \end{bmatrix} = \begin{bmatrix}6 \\-4 \\27 \end{bmatrix}$$

If these three matrices are called A, X and B, the equation becomes −

A*X = B  

Or

X = A-1B 
numpy_linear_algebra.htm
Advertisements