Introduction to NumPy and Matplotlib
Chapter 6: NumPy functions
Mathematical functions
Let’s get back to being practical!
Your task now is to take a quick glance at all the lovely mathematical functions provided by NumPy
in the documentation. These can be used in a vectorised manner (i.e. applied to whole np.array
s without loops).
Confusingly, many (but not all) of these are also methods of np.array
. so both np.mean(x)
and x.mean()
work! I personally prefer the OOP version as it is shorter.
These are all pretty straightforward and self-explanatory though. So rather than me listing out all the possible functions, I’ll just let you do a quick quiz to try to explore some of these yourself!
❮
❯