Task-
-Addition of two matrix
For sum up two matrix , there shape(order) must be same.
Example-
first matrix is :
[[2 2]
[1 1]]
second matrix is :
[[1 0]
[0 1]]
Then Addition of both matrix is :
[[3 2]
[1 2]]
program-
#import numpy
import numpy as np
l=[[1,2,3],[4,5,1],[1,1,1]]
arr1=np.array(l)
print("nMatrix1 is :n",arr1)
l=[[1,2,3],[0,0,0],[1,1,0]]
arr2=np.array(l)
print("nMatrix 2 is :n",arr2)
print("nAddition of both matrix is n",arr1+arr2)
Matrix1 is :
[[1 2 3]
[4 5 1]
[1 1 1]]
Matrix 2 is :
[[1 2 3]
[0 0 0]
[1 1 0]]
Addition of both matrix is
[[2 4 6]
[4 5 1]
[2 2 1]]