Python linear equations solution example: python Linear Equations
This article describes how to solve Python linear equations. We will share this with you for your reference. The details are as follows:
Solving Linear Equations is relatively simple. You only need to use one function (Scipy. linalg. solve
. For example, we need the solution of the following equation, which is a non-homogeneous linear equations:
3x_1 + x_2-2x_3 = 5
X_1-x_2 + 4x_3 =-2
2x_1 + 3x_3 = 2.5
The Code is as follows:
# Coding = utf-8import numpy as npfrom scipy. linalg import solvea = np. array ([[3, 1,-2], [1,-1, 4], [2, 0, 3]) B = np. array ([5,-2, 2.5]) x = solve (a, B) print ("helper house Test Result:") print (x)
Output result:
PS: Here are some recommended computing tools for your reference:
Calculation tool for online mona1 functions (equations:
Http://tools.jb51.net/jisuanqi/equ_jisuanqi
Scientific calculator online use _ advanced calculator online computing:
Http://tools.jb51.net/jisuanqi/jsqkexue
Online calculator _ standard calculator:
Http://tools.jb51.net/jisuanqi/jsq