Finding Your Way Variables and Functions

The NumPy package provides us with two useful helper functions. I call them helper functions because they don't fall into any specific numerical analysis or signal processing category.

When one works in an interactive environment, one constantly defines variables. It's hard to remember what variables are defined and what they mean. The function who() prints a list of all ndarray variables (NumPy arrays):

Upper bound on total bytes = 0

>>> up, down = arange(io), arange(lO, 0, -l)

Name Shape Bytes Type down 10 40 int32

up 10 40 int32

Upper bound on total bytes = 80

The function lookfor() is great for searching inside docstrings. So to look for functions that perform numerical integration, issue

>>> lookfor('integrate') Search results for 'integrate'

numpy.trapz

Integrate y(x) using samples along the given axis and the composite

Was this article helpful?

0 0

Post a comment