Have you tried to add or substract matrices in python?
So this is the recipe on how we can add and subtract between matrices.
import numpy as np
We have only imported numpy which is needed.
We have created two matrices on which we will perform operations.
matrixA = np.array([[2, 3, 23],
[5, 6, 25],
[8, 9, 28]])
matrixB = np.array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
First we are adding the two matrices using the numpy function np.add. After that we are performing substraction by using the numpy function np.subtract, in both the function we have passed the matrices.
print(np.add(matrixA, matrixB))
print(np.subtract(matrixA, matrixB))
So the output comes as
[[ 3 5 26] [ 9 11 31] [15 17 37]] [[ 1 1 20] [ 1 1 19] [ 1 1 19]]