np.linalg.solve(np. linalg. solve)-其他

np.linalg.solve(np. linalg. solve)

>>> a = np.random.rand(10,10)
>>> b = np.random.rand(10)
>>> x = np..solve(a,b)
>>> np.sum(np.abs(np.dot(a,x) - b))
3.1433189384699745e-15

solve函数有两个参数a和b。a是一个N*N的二维数组，而b是一个长度为N的一维数组，solve函数找到一个长度为N的一维数组x，使得a和x的矩阵乘积正好等于b，数组x就是多元一次方程组的解。

————————

Some of the more advanced operations in the matrix can be found in the linear algebra sub library linalg of numpy. For example, the inv function calculates the inverse matrix, and the solve function can solve the multivariate linear equations. The following is an example of the solve function:

>>> a = np.random.rand(10,10)
>>> b = np.random.rand(10)
>>> x = np..solve(a,b)
>>> np.sum(np.abs(np.dot(a,x) - b))
3.1433189384699745e-15

The solve function has two parameters a and B. A is a two-dimensional array of n * n, and B is a one-dimensional array with length n. The solve function finds a one-dimensional array x with length N, so that the matrix product of a and X is exactly equal to B, and array x is the solution of the system of multivariate primary equations.