My Coding >
Programming language >
Python >
Python libraries and packages >
Python NumPy >
NumPy: How to solve system of linear equations
NumPy: How to solve system of linear equationsSolving of the system of linear equations is a very common task in modern science. In this short tutorial I will solve system of 4 linear equations with NumPy library in Python.
Now, nobody solve these kind of equations as a system of equations. Everybody use matrices to solve it. AX = B or in more details:
Matrix solution is pretty simple X = A^{1}B where A^{1} is an inverse of the A matrix. So AA^{1} = I Solving with NumPySolving with matrix equationFirst of all, we need to prepare all data:
Then we need to find inverse of the A matrix
And then the solution will be the dot product of inverse of the matrix A to vector B. Also we can check the solution with using our vector X in our original dot product AX and check that this vector is collinear to B
Solving with build in NumPy function linalg.solveIt is not necessary to use all this linear algebra equations. NumPy already have all required functions in linalg library

Last 10 artitles
9 popular artitles


© 2020 MyCoding.uk My blog about coding and further learning. This blog was writen with pure Perl and frontend output was performed with TemplateToolkit. 