Mathematical functions

Just import the numpy library which contains all the mathematical functions and constants such as pi. import numpy as np. It has all the standard functions such as np.sin, np.cos, np.tan, np.exp, ....

Note that these functions also take arrays as arguments. For example, inputting the array x into the sine:

x = np.array(range(6))
y = np.sin(x);
yields again an array in y! All elements have been processed at the same time.



github / contact

Creative Commons License