Reputation:
import numpy as np
a=np.array([[36,98,54],
[75,89,15],
[37,94,63]])
b=np.array([[53,56,93],
[12,45,66],
[19,28,89]])
c=matsum(a,b)
print(c)
Matsum says it is not defined, but i imported the numpy library?
----> 8 c=matsum(a,b)
NameError: name 'matsum' is not defined
Upvotes: 0
Views: 131
Reputation: 66
I think this is what you are looking for:
import numpy as np
a = np.array([[36, 98, 54],
[75, 89, 15],
[37, 94, 63]])
b = np.array([[53, 56, 93],
[12, 45, 66],
[19, 28, 89]])
c = np.add(a, b)
print(c)
or just do what @Shubham Shaswat suggested: import numpy as np
a = np.array([[36, 98, 54],
[75, 89, 15],
[37, 94, 63]])
b = np.array([[53, 56, 93],
[12, 45, 66],
[19, 28, 89]])
c = a + b
print(c)
both return
[[ 89 154 147]
[ 87 134 81]
[ 56 122 152]]
Upvotes: 0