The figure lab
46 interactive figures across 12 fields. Each one can be dropped into an essay with a single line.
Development only: this catalogue is not published. Set lab.publish in src/site.ts to put it on the live site.
Mathematics
- interactiveBifurcation diagram of the logistic mapLong-run values of xₙ₊₁ = r·xₙ(1 − xₙ) against r: fixed point, period doubling, chaos, and windows of order inside it.
- interactiveLagrange multipliers: gradients line upA point circles the constraint while the gradients of f and g are drawn. They are parallel exactly where f has zero s…
- interactiveLinear programming: the optimum is a vertexRotate the objective and the optimal vertex jumps from corner to corner of the feasible polygon.
- interactiveLP duality: multipliers certify the optimumEach vertex determines dual variables from its two active constraints. The vertex is optimal exactly when they are al…
- paramSpirograph (hypotrochoid)A point on a circle rolling inside a larger circle draws a hypotrochoid. Change the radii and the pen offset; the cur…
- interactiveSquare wave from rotating circlesCircles of radius 4/(πk) chained head to tail: the height of the tip is the Fourier partial sum.
- interactiveThe Lagrangian is a saddleRotate the surface L(x, λ). Along x it is a bowl, along λ a line; the constrained optimum and its multiplier sit at t…
- interactiveWeak and strong duality, and the gapSweep the multiplier λ: the dual function climbs towards the primal optimum. For a convex problem it reaches it; for …
- interactiveWhat a matrix does to the planeDrag the columns of a 2×2 matrix: determinant, eigenvectors and singular values as a deformed grid and ellipse.
Probability & Statistics
Physics
- interactiveA double pendulum: sensitive dependence on initial conditionsTwo double pendulums start a millionth of a radian apart. They swing together at first, then fly apart: the separatio…
- fieldElectric field and field linesThe field of two point charges as the second charge slides from negative to positive: a dipole becomes two like charg…
- interactiveKepler's second law: equal areas in equal timesA planet speeds up near the Sun and slows far away, in exactly the way that makes the line to the Sun sweep equal are…
- odeLorenz attractorThree coupled equations from a model of convection. Nearby trajectories diverge exponentially, yet stay on the butter…
- fnSuperposition and beatsTwo travelling waves of nearby frequency add to a fast carrier under a slow envelope that moves at the group velocity…
- contourTwo-source interferenceWaves spread from two point sources. Where crests meet crests they reinforce, where crests meet troughs they cancel, …
Biology
Digital Logic
Computer Architecture
- interactiveA cache, step by stepReplay an address trace through a cache you configure: direct-mapped to fully associative, LRU, FIFO, random or optim…
- interactiveBranch predictors: 1-bit, 2-bit and gshareStep through a branch trace and watch a saturating counter learn. See why a loop costs a 1-bit predictor two mispredi…
- interactiveCache coherence: MSI and MESICores read and write one shared cache line. Watch the per-core states and the bus traffic, and see what the Exclusive…
- interactiveFetch, decode, execute: a tiny CPUA four-register machine runs loops of real instructions. Follow the program counter, registers and memory one instruc…
- interactiveMemory models: litmus testsEnumerate every outcome of classic two-thread tests under sequential consistency, x86-style TSO and a weaker model. S…
- interactiveThe 5-stage pipeline and its hazardsA time–space diagram of IF/ID/EX/MEM/WB. Toggle forwarding, choose where branches resolve, and count the stall cycles…
- interactiveWhy loop order matters: row vs column traversalSumming a matrix row by row reuses each cache block four times; column by column wastes it. Same work, wildly differe…
Operating Systems
- interactiveCPU scheduling algorithmsFCFS, shortest-job-first, shortest-remaining-time, round-robin and priority scheduling on the same workload: a Gantt …
- interactivePage replacement: FIFO, LRU, OPT, ClockStep through a reference string with a handful of physical frames and count page faults under four replacement policies.
- interactiveThe buddy allocatorPower-of-two blocks split on demand and coalesce with their buddy when freed. See internal fragmentation and merging.
- interactiveVirtual to physical: page tables and the TLBTranslate 16-bit virtual addresses through a two-level page table, with a small TLB. See hits, walks, and page faults.
Concurrency
- interactiveModel-checking mutual exclusionThree attempts at a two-thread lock. A breadth-first search of every interleaving finds the counterexample, or proves…
- interactiveProducer–consumer with semaphoresA bounded buffer guarded by two counting semaphores and a mutex. Swap two lines and it can deadlock.
- interactiveThe dining philosophersEveryone grabs the left fork first and nobody can eat. Find the deadlock by search, then break it by ordering the res…
Algorithms
- interactiveDijkstra's shortest pathsSettle the nearest node, relax its edges, repeat. Step through a weighted graph with the distance table in view.
- interactiveEdit distance dynamic programmingThe Levenshtein table filled one cell at a time, three neighbours per cell, then traced back to an optimal edit script.
- interactiveLagrangian relaxation of a constrained shortest pathA weight budget makes shortest path hard. Price the weight with λ and it becomes a plain shortest path again; sweep λ…
- interactivePathfinding: BFS, DFS and A*Three searches on the same maze. BFS finds the shortest path by exploring everything nearby; DFS dives and finds a lo…
- interactiveSorting algorithms, side by sideBubble, insertion, selection, shell, merge, quick and heap sort on random, sorted, reversed and few-unique inputs, wi…
- interactiveTower of HanoiMove n discs between pegs in 2ⁿ − 1 moves, following the recursive solution move by move.
Data Structures
Machine Learning
- interactiveA neural network learns XORNo single line separates XOR. A hidden layer, trained by backpropagation, bends the decision boundary around it.
- interactiveGradient descent playgroundDrag the start point on three landscapes; change step size and momentum; watch stability, zig-zags and divergence.
- interactivek-means clusteringAlternately assign points to the nearest centroid and move centroids to their mean. Inertia only ever falls, but the …
Simulation
- interactiveConway's Game of LifeTwo simple rules on a grid produce gliders, oscillators and chaos. Run, step and restart from classic patterns.
- interactiveMandelbrot and Julia setsIterate z → z² + c. The Mandelbrot set records which c keep z bounded; each point of it is a Julia set. Pan, zoom and…
- interactiveThe Ising modelA grid of magnetic spins flipping by the Metropolis rule. Below the critical temperature ≈ 2.27 domains order; above …
- interactiveTraffic jams: the Nagel–Schreckenberg modelCars accelerate, brake, and occasionally dawdle. Phantom jams appear from nothing and move backwards; flow peaks at a…