⏱ 1 minute read
Python for Math & ML
Essential Python tools for mathematical computing and machine learning.
Core Stack
| Library |
Purpose |
Install |
| NumPy |
Arrays, linear algebra, FFT |
pip install numpy |
| SciPy |
Optimization, integration, stats |
pip install scipy |
| Matplotlib |
2D plotting |
pip install matplotlib |
| SymPy |
Symbolic math |
pip install sympy |
| Jupyter |
Interactive notebooks |
pip install jupyter |
Quick Start: NumPy Essentials
| import numpy as np
# Create arrays
a = np.array([1, 2, 3]) # Shape: (3,)
M = np.array([[1, 2], [3, 4]]) # Shape: (2, 2)
# Operations
print(M @ M) # Matrix multiply
print(M.T) # Transpose
print(M @ M.T) # Symmetric product
print(np.linalg.eigh(M)) # Eigenvalues/eigenvectors
print(np.linalg.svd(M)) # SVD
|
Manim Setup (WSL)
| # Install Manim in WSL Ubuntu
pip install manim
sudo apt-get install -y latexmk texlive-latex-extra dvisvgm
# Render a scene
manim -pql scene.py SceneName
|