NumPy, Arrays, and Vectorized Functions

numpy arrays

  1. Compare and contrast lists and numpy arrays.
  2. Generate a numpy array using np.array().
  3. Query the shape of a numpy array using the shape attribute.

1D numpy arrays

  1. State the mental picture for thinking about a 1D numpy array.
  2. Explain what element-wise means with respect to binary arithmetic operators with numpy arrays.

Generating Structured numpy arrays

  1. Use np.arange() to generate a given numpy array.
  2. Use np.linspace() to generate a given numpy array.

Indexing and Slicing numpy arrays

  1. Use indexing and slicing to access elements and sub-arrays of a numpy array.

Vectorization

  1. Define vectorization.
  2. Explain the advantages of vectorized functions.
  3. Use vectorized functions from numpy, e.g. np.sin(), np.exp(), np.log(), etc.
  4. Use np.sum() and np.prod() to evaluate sums and products.

Quadrature via Vectorized Code

  1. Implement: using numpy arrays and vectorized functions.