1. Introduction to NumPy
What is NumPy: NumPy (Numerical Python) is a fundamental library for numerical computing in
Python, providing support for large, multi-dimensional arrays and matrices.
History of NumPy: NumPy was created in 2006 by Travis Oliphant, building on the earlier Numeric
and Numarray libraries.
Key Features: NumPy offers efficient operations on arrays, broadcasting, mathematical functions,
linear algebra, and random number generation.
2. NumPy Arrays
Array Creation: NumPy arrays can be created using the array() function, as well as functions like
zeros(), ones(), and arange().
Array Indexing: Elements in a NumPy array can be accessed and modified using zero-based
indexing, slicing, and fancy indexing.
Array Shape and Reshaping: The shape attribute returns the dimensions of an array, and arrays can
be reshaped using reshape() or ravel() to flatten arrays.
3. Operations on NumPy Arrays
Element-wise Operations: NumPy allows for element-wise arithmetic operations (addition,
subtraction, multiplication, etc.) on arrays of the same shape.
Broadcasting: Broadcasting enables arithmetic operations on arrays of different shapes, following
specific broadcasting rules.
Universal Functions: NumPy's universal functions (ufuncs) apply element-wise operations over
arrays, such as sin(), exp(), and log().
4. NumPy and Linear Algebra
Matrix Operations: NumPy provides functions for matrix multiplication (dot()), matrix inverse (inv()),
and matrix transposition (T).
Eigenvalues and Eigenvectors: NumPy's linalg module includes functions for computing eigenvalues