In [19]:
import numpy as np
In [20]:
a = np.array([[2, 4], [0, 4], [7, 9], [3, 7]])
In [21]:
b = np.array([[9, 2], [4, 1], [1, 7], [0, 2]])
In [22]:
a + b
Out[22]:
array([[11,  6],
       [ 4,  5],
       [ 8, 16],
       [ 3,  9]])
In [23]:
c = np.array([[1, 3, 7], [2, 9, 0]])
In [24]:
c + b
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-24-93e37e1cb2c9> in <module>()
----> 1 c + b

ValueError: operands could not be broadcast together with shapes (2,3) (4,2) 
In [25]:
6 * c
Out[25]:
array([[ 6, 18, 42],
       [12, 54,  0]])
In [26]:
d = np.array([[6, 3], [0, 1]])
In [27]:
d / 3
Out[27]:
array([[2.        , 1.        ],
       [0.        , 0.33333333]])
In [28]:
e = np.array([[2], [1], [0], [3]])
In [29]:
f = np.array([[4], [2], [3], [1]])
In [30]:
g = np.array([[6], [0], [3], [12]])
In [31]:
(5 * e) - f + (g / 6)
Out[31]:
array([[ 7. ],
       [ 3. ],
       [-2.5],
       [16. ]])