New Simulations
Duffing Oscillator — Chaos via Phase Portrait & Poincaré Section
RK4 integration of ẍ + δẋ + αx + βx³ = γcos(ωt). Left canvas: phase portrait (x, ẋ) with fading trail + Poincaré dots sampled every forcing period. Right: x(t) time series. Five presets range from clean chaos to damped decay.
Network Science — Erdős–Rényi, Barabási–Albert, Watts–Strogatz
Force-directed graph visualization covering three fundamental random network models. Real-time BFS component detection, degree-distribution histogram, clustering coefficient and giant-component fraction. Drag nodes to explore topology.
Turing Diffusion — Gray-Scott Reaction-Diffusion Morphogenesis
256×256 Gray-Scott model on a periodic grid. Five presets (spots, stripes, maze, coral, mitosis) explore the (F,k) parameter space. Click to plant seeds. Four colour maps; real-time pattern-type detection.
🌀 Duffing Oscillator — Classical Chaos with a Cubic Spring
The equation
George Duffing (1918) introduced one of the first deliberately studied nonlinear oscillators to model hardening springs in machinery. The driven version reads:
ẍ + δẋ + αx + βx³ = γ cos(ωt)
The cubic term βx³ is the key nonlinearity: for β > 0 (hardening) the effective stiffness increases with amplitude; for β < 0 it decreases. The driving force γcos(ωt) continuously injects energy, which damping δẋ dissipates. When driving and damping are balanced in a nonlinear regime, chaotic motion can emerge.
Phase portrait and Poincaré sections
The simulation runs an RK4 integrator with Δt = 0.005 and renders two visualizations simultaneously:
- Phase portrait (left) — Position x vs. velocity ẋ with a fading 3 000-point trail. Periodic orbits appear as closed loops; chaotic motion fills a fractal region of phase space.
- Poincaré section (red dots) — The state (x, ẋ) is sampled whenever ωt mod 2π passes through zero, i.e., once per forcing period T = 2π/ω. For a period-1 orbit, one dot appears; for period-n, n distinct dots; for chaos, a fractal cloud.
- Time series (right) — x(t) reveals whether the motion is periodic, quasi-periodic, or aperiodic.
Preset regimes
- Chaos (α=−1, β=1, δ=0.3, γ=0.5, ω=1.0) — The classic double-well chaotic Duffing with a dense fractal Poincaré section and positive Lyapunov exponent.
- Period-2 (γ=0.28, ω=1.2) — Subharmonic resonance: two Poincaré dots, x(t) period = 2T.
- Double-well (δ=0.5, γ=0.1) — Low forcing; the trajectory settles into one potential well, showing a stable limit cycle.
- Resonance (α=1, β=0.1, δ=0.1) — Single-well hardening spring near resonance; large amplitude periodic orbit.
- Damped (α=1, β=0.5, δ=0.8) — High damping; x(t) decays to zero, confirming stability of x=0.
Regime detector
The Poincaré x-values from the last 100 crossings are accumulated. The variance of this buffer classifies motion: variance > 0.05 → Chaotic; variance > 0.01 → Period-2+; otherwise Periodic. Small samples make this heuristic imperfect, but it stabilises reliably within a few hundred periods.
🌐 Network Science — Three Models of Graph Structure
Why network topology matters
The structure of a network — which nodes connect to which — determines how information, disease, influence or failure propagates through it. Three models capture fundamentally different structural regimes:
- Erdős–Rényi G(N,p) — Each pair of N nodes is connected independently with probability p. Degree distribution is Poisson-like. Above the giant-component threshold p_c = 1/N, a single large connected component appears abruptly — a percolation phase transition.
- Barabási–Albert — Nodes added one at a time; each new node attaches m edges preferentially to nodes with higher degree ("rich get richer"). Generates a power-law degree distribution P(k) ~ k^−3, matching the Internet, citation networks and social graphs.
- Watts–Strogatz — Start with a regular ring lattice (each node connected to k nearest neighbours), then rewire each edge with probability β. Low β: high clustering, high path length (regular). High β: low clustering, low path length (random). Intermediate β: high clustering, low path length — the "small-world" regime matching neural networks & power grids.
Force-directed layout
Node positions are computed by a lightweight Fruchterman-Reingold-style algorithm running at each animation frame: repulsive force ∝ 1/d² pushes all node pairs apart; spring attraction ∝ (d − 60) pulls connected nodes together; a weak centre gravity ∝ 0.003 keeps the graph on screen. Damping 0.88 stabilizes the layout. Nodes can be dragged to anchor positions; releasing resumes physics.
Statistics panel
Computed after every regraph: node count, edge count, average degree ⟨k⟩, global clustering coefficient C, giant component fraction, and max degree (hub size for BA networks). The degree distribution histogram on the right panel uses a log-count y-axis to reveal the power-law tail in BA mode.
🔬 Turing Diffusion — How Alan Turing Explained Biological Patterns
The 1952 paper
In "The Chemical Basis of Morphogenesis" (Philosophical Transactions of the Royal Society B, 1952), Alan Turing showed mathematically that a homogeneous mixture of two reacting chemicals — one (activator) that enhances its own production and a second (inhibitor) that suppresses the activator and diffuses faster — can spontaneously break spatial symmetry and form stable periodic patterns. This Turing instability is now considered the leading theoretical explanation for animal coat markings, finger spacing in embryonic limb development, and the spacing of hair follicles.
Gray-Scott model equations
The simulation implements the Gray-Scott variant, which captures the activator-inhibitor dynamics cleanly:
∂U/∂t = Dᵤ ∇²U − UV² + F(1 − U)
∂V/∂t = Dᵥ ∇²V + UV² − (F + k)V
U is the inhibitor (fed from outside at rate F, consumed by the UV² reaction); V is the activator (consumed at rate k+F, produced autocatalytically via UV²). The Laplacian ∇² is discretized on a 256×256 periodic grid with a 5-point stencil. A forward-Euler step with Δt = 1.0 is stable for the diffusion coefficient values used.
The (F, k) parameter space
Small differences in feed rate F and kill rate k produce qualitatively different steady-state patterns:
- Spots (F=0.055, k=0.062) — Isolated spots of high-V activity on a low-V background. Resembles animal spots and leopard coat patterns.
- Stripes (F=0.060, k=0.058) — Parallel stripe domains. Close to zebra-stripe and fish-marking parameter regimes.
- Maze (F=0.029, k=0.057) — Connected labyrinthine channels. Common in sea shell pigmentation.
- Coral (F=0.037, k=0.060) — Crenellated, dendritic structures resembling coral polyps.
- Mitosis (F=0.028, k=0.053) — Spots that self-replicate by splitting, mimicking cell division.
Click anywhere on the canvas to inject a seed of high-V concentration. The seed triggers pattern growth from that location — useful for watching pattern invasion fronts.
Colour maps and pattern detection
Four colour maps render the V-field: Alien (green/teal/black emphasises mid-range detail), Heat (black→red→yellow), Mint (dark to bright green), and Monochrome (greyscale for publication-style output). The pattern-type classifier computes average V and uses (F,k) heuristics to label the current regime.
Looking Ahead
Wave 61 candidates from the queue include viscoelastic fluid dynamics, cellular-automata rule explorer, an interactive double-pendulum ensemble showing chaos onset across initial conditions, and signal-processing tools (DFT / STFT visualizer). We're also planning a collections / bookmarks feature so visitors can curate and share sets of simulations.