NumPy, Arrays, and Vectorized Functions
numpy
array
s
- Compare and contrast
list
s and numpy
array
s.
- Generate a
numpy
array
using np.array()
.
- Query the shape of a
numpy
array
using the shape
attribute.
1D numpy
array
s
- State the mental picture for thinking about a 1D
numpy
array
.
- Explain what element-wise means with respect to binary arithmetic operators with
numpy
array
s.
Generating Structured numpy
array
s
- Use
np.arange()
to generate a given numpy
array
.
- Use
np.linspace()
to generate a given numpy
array
.
Indexing and Slicing numpy
array
s
- Use indexing and slicing to access elements and sub-arrays of a
numpy
array
.
Vectorization
- Define vectorization.
- Explain the advantages of vectorized functions.
- Use vectorized functions from
numpy
, e.g. np.sin()
, np.exp()
, np.log()
, etc.
- Use
np.sum()
and np.prod()
to evaluate sums and products.
Quadrature via Vectorized Code
- Implement:
- left / right Riemann sums
- the midpoint rule
- the trapezoidal rule
using numpy
array
s and vectorized functions.