Python Numpy Tutorial #2

In our last tutorial, we talked about numpy arrays. If you have not read it, visit here. In this post, we will deeper into numpy and talk a bit about the various tools it provides us. At first, we will see how arithmetic operations work in numpy arrays and the numpy universal functions, ending this tutorial with broadcasting. Array Maths: Basic element-wise addition, subtraction, multiplication, and division can be done in this way : import numpy as np x = np . array([[ 1 , 2 ],[ 3 , 4 ]]) y = np . array([[ 5 , 6 ],[ 7 , 8 ]]) print (x + y) #element-wise addition print (x - y) #element wise subtraction print (x * y) #element-wise multiplication print (x / y) #element-wise division #For all these operations, the first operand will be from x and the second operand from y The output will be an array of the operation on the two vectors. The dot product of two matrices can be calculated in the following way: import numpy as np x ...