Prerequisites:
先決條件:
Defining a Matrix
定義矩陣
Identity Matrix
身份矩陣
There are matrices whose inverse is the same as the matrices and one of those matrices is the identity matrix.
有些矩陣的逆與矩陣相同,并且這些矩陣之一是單位矩陣。
I-.1 = I
Syntax:
句法:
inv_M = numpy.linalg.inv(I)
Here, "M" is the an identity matrix.
在此,“ M”是單位矩陣。
Python代碼查找單位矩陣的逆矩陣 (Python code to find the inverse of an identity matrix)
# Linear Algebra Learning Sequence
# Inverse of a Identity Matrix
import numpy as np
I = np.eye(6)
print("---Matrix I---\n", I)
ai = np.linalg.inv(I)
print('\n\nInverse of A as ----\n', ai)
print('\n\nThe Matrices are same')
Output:
輸出:
---Matrix I---
[[1. 0. 0. 0. 0. 0.]
[0. 1. 0. 0. 0. 0.]
[0. 0. 1. 0. 0. 0.]
[0. 0. 0. 1. 0. 0.]
[0. 0. 0. 0. 1. 0.]
[0. 0. 0. 0. 0. 1.]]
Inverse of A as ----
[[1. 0. 0. 0. 0. 0.]
[0. 1. 0. 0. 0. 0.]
[0. 0. 1. 0. 0. 0.]
[0. 0. 0. 1. 0. 0.]
[0. 0. 0. 0. 1. 0.]
[0. 0. 0. 0. 0. 1.]]
The Matrices are same
翻譯自: https://www.includehelp.com/python/inverse-of-an-identity-matrix.aspx