Code Explanation:
Step 1: Import NumPy
import numpy as np
numpy is a library for numerical computing in Python.
Step 2: Define Matrices
A and 𝐵
A = np.array([[1, 2], [3, 4]])
B = np.array([[5, 6], [7, 8]])
A and B are 2×2 matrices:
A=[ 13 24]
B=[ 57 68]
Step 3: Compute the Matrix Multiplication
result = np.dot(A, B)
The np.dot(A, B) function computes the dot product (matrix multiplication for 2D arrays).
Matrix Multiplication Formula:
C=A⋅B
Step 4: Print the Result
print(result)
Final Output:
[[19 22]
[43 50]]
0 Comments:
Post a Comment