Numerical methods
How the simulations on this site actually work.
Almost every interactive on this site is running a numerical algorithm. The slope-field interactive in Foundations 5.1 integrates ODE trajectories with RK4. The wave/heat side-by-side panel in Foundations 6.1 discretises the wave equation with the leapfrog scheme and the heat equation with forward Euler, both subject to stability constraints. The Laplace solver in Foundations 6.6 iterates Jacobi relaxation until the residual decays. The characteristic-equation carousel in Foundations 5.2 solves a polynomial; the eigenvector finder in 4.4 runs power iteration.
This chapter explains the algorithms. Each lesson covers one technique that appears repeatedly across the bookshelf, develops it from first principles, and ends with the kind of stability and convergence analysis that makes the difference between a simulation that works and one that diverges or grinds for hours.
The chapter is built as six self-contained lessons:
- 10.1 Discretization — turning continuous calculus into arithmetic on discrete grids; forward, backward, and centred differences; the trade-off between truncation error and floating-point cancellation.
- 10.2 ODE solvers — forward Euler, midpoint (RK2), and Runge–Kutta 4; the order-of-accuracy framework and the stability boundary that limits explicit methods.
- 10.3 Finite differences for PDEs — the leapfrog scheme for the wave equation, forward Euler for the heat equation, and the CFL stability condition that links time step to spatial grid.
- 10.4 Elliptic problems and relaxation — Jacobi and Gauss–Seidel iteration for Laplace’s equation; the convergence rate and what makes multigrid so much faster.
- 10.5 The FFT — the Cooley–Tukey algorithm and its O(N log N) cost, which is what makes every spectrogram on this site possible.
- 10.6 Root-finding — bisection and Newton’s method, including Newton’s quadratic convergence and the fractal basins of attraction that make starting-point choice non-trivial.
The aim of the chapter is that you can re-implement any interactive on the site yourself. By the end, “where the numbers come from” should no longer be a black box.