Jupyter Notebook Library
Downloadable, fully-executable notebooks that mirror the in-browser workbenches for offline / local Jupyter use.
These 14 notebooks are the local companions to the interactive
workbenches on this site. Each one is self-contained (theory recap,
worked reference implementation, tests, and a plot), seeded for reproducibility
(SEED = 42, rng = np.random.default_rng(SEED)), and ships with
assertions that check results against closed-form or known values.
How to run them. Download a notebook, then from that folder launch Jupyter and open it:
pip install numpy scipy pandas scikit-learn statsmodels matplotlib jupyter
jupyter notebook # then open the .ipynb and Run All
Every notebook executes top-to-bottom without error and prints
All tests passed. at the end of its test cell.
14/14 notebooks in this build executed cleanly in headless CI.
Phase 2 - Single-Variable Calculus
- Numerical Differentiation tests passFinite-difference derivatives, error scaling in the step h, and Richardson extrapolation.
- Numerical Integration Engine tests passMidpoint, trapezoid and Simpson rules, their convergence orders, and improper integrals.
Phase 4 - Linear Algebra
- Matrix Factorizations from Scratch tests passLU with pivoting, Gram–Schmidt QR and Cholesky, each verified against NumPy.
- Least Squares & PCA tests passSolve least squares via normal equations and QR, then run PCA on a synthetic return matrix.
Phase 7 - Probability Theory
- Probability Simulation: LLN & CLT tests passSampling, the Law of Large Numbers, CLT convergence, and empirical vs theoretical moments.
Phase 8 - Stochastic Processes & Brownian Motion
- Brownian Motion & GBM tests passSimulate standard Brownian motion, verify quadratic variation -> T, and generate GBM paths.
Phase 9 - Stochastic Calculus
- Itô SDEs: Euler–Maruyama tests passEuler–Maruyama for GBM vs the exact solution, and empirical strong/weak error orders.
Phase 11 - Statistics & Statistical Learning
- Regularized Regression & Walk-Forward CV tests passRidge/Lasso, time-aware walk-forward cross-validation, a leakage demo, and cost-aware evaluation.
Phase 12 - Time-Series Analysis
- ARIMA Forecasting tests passSimulate AR/ARMA processes, fit with statsmodels, inspect ACF/PACF, and forecast with intervals.
- 1-D Kalman Filter & Smoother tests passImplement a scalar Kalman filter to track a noisy random walk and compare to the RTS smoother.
Phase 13 - Monte Carlo Methods
- Monte Carlo Option Pricer tests passMC European pricing with standard error, plus antithetic and control-variate variance reduction.
Phase 14 - Mathematical Finance
- Black–Scholes & the Greeks tests passThe BS formula, all Greeks, put-call parity, and implied vol via Newton and Brent.
Phase 15 - Derivatives & Volatility
- Implied-Volatility Surface tests passBuild a smile from synthetic prices, check butterfly/calendar no-arbitrage, and interpolate.
Phase 16 - Algorithmic & High-Frequency Trading
- LOB & Optimal Execution tests passA synthetic limit order book, a market-impact model, and TWAP vs front-loaded (Almgren–Chriss) cost.