My question Regarding Python matrix. How to create a python matrix multiplication.
- For example, multiply 8 * 4 and 4 * 6?
My question Regarding Python matrix. How to create a python matrix multiplication.
You could use numpy
library by using matmul(MatrixA,MatrixB)
method.
In this method matmul
you can pass two arguments "MatrixA" & "MatrixB" and it will multiply both matrixes together
import numpy as np
# Matrix A
A = [[2, 4],
[6, 8]]
# Matrix B
B = [[1, 3],
[5, 7]]
"""
It will do the following:
A = [[2,4],[6,8]]
B = [[1,3],[5,7]]
After running the method
C = [[2*1, 4*3],[6*5, 8*7]] = [[2, 12],[30, 56]]
"""
print(np.matmul(A,B))
For more Information, you can head to this topic here