Prerequisites:
先决条件:
Syntax:
句法:
inv_M = numpy.linalg.inv(M)
Here, "M" is the matrix.
在此,“ M”是矩阵。
Python代码查找矩阵的逆 (Python code to find the inverse of a matrix)
# Linear Algebra Learning Sequence
# Inverse of a Matrix
import numpy as np
M = np.array([[2,3,4], [3,45,8], [4,8,78]])
print("---Matrix A---\n", M)
ai = np.linalg.inv(M)
print('\n\nInverse of A as ----\n', ai)
Output:
输出:
---Matrix A---
[[ 2 3 4]
[ 3 45 8]
[ 4 8 78]]
Inverse of A as ----
[[ 0.60861886 -0.03567644 -0.0275521 ]
[-0.03567644 0.02472625 -0.00070646]
[-0.0275521 -0.00070646 0.0143059 ]]
翻译自: https://www.includehelp.com/python/inverse-of-a-matrix.aspx