Identity Matrix in Numpy
- Numpy Import
- Initialize matrix A and B
- Show Matrix A
- Show Matrix B
- Convert Matrix A from List to Numpy Array
- Convert Matrix B from List to Numpy Array
- Initialize a 2 by 2 identity matrix
- Show Matrix I
- What happens when we multiply I*A ?
- What happens when we multiply A * I ?
import numpy as np
A = [[1, 2], [4,5]]
B = [[1,1], [0, 2]]
A
B
A_np = np.array(A)
A_np
B_np = np.array(B)
B_np
I = np.eye(2)
I
IA_np = I @ A_np
IA_np
A_npI = A_np @ I
A_npI