01 Key Concepts
The NumPy Array
NumPy's ndarray is like a Python list but far faster for math, supporting element-wise operations directly (no loops needed).
Creating Arrays
np.array([1,2,3]) creates a 1D array; np.array([[1,2],[3,4]]) creates a 2D array (matrix).
Element-wise Operations
Operations like array1 + array2 or array * 2 apply automatically to every element, unlike plain Python lists.
Useful Array Functions
np.mean(), np.sum(), np.max(), np.min(), and np.std() compute common statistics directly on an array.
Matrix Operations
NumPy supports matrix multiplication with np.dot() or the @ operator, plus np.linalg functions for determinants, inverses, and eigenvalues.
02 Key Formulas
- np.array([1,2,3]) creates a 1D array
- np.mean(arr) computes the average
- np.dot(A, B) or A @ B performs matrix multiplication
03 Solved Examples
- Sum the elements: 2+4+6+8=20.
- Divide by the count: 20/4.
- NumPy applies the multiplication to every element.
- 1*2=2, 2*2=4, 3*2=6.
- Element-wise addition: 1+3=4, 2+4=6.
04 Practice Questions
๐ NumPy โ Downloadable Worksheet
10 questions with a full answer key. Grab the PDF to print, or try the interactive version in your browser.