Wave 54 at a glance
Van der Pol Sync
Two coupled nonlinear oscillators integrated with RK4. Tune damping μ, coupling κ, and initial phase offset Δφ to explore in-phase, anti-phase, and quasi-periodic behaviour.
Open simulation →Bacterial Colony
Run-and-tumble chemotaxis on a 60×60 nutrient field. Gradient sensing biases tumble probability. Watch quorum-sensing biofilm form when local density exceeds the threshold.
Open simulation →Genetic Evolution
Creatures with 4-gene float genomes (speed, sight, efficiency, aggression) compete for food. Tournament selection + Gaussian mutation drives adaptation across generations.
Open simulation →♡ Van der Pol Oscillator Synchronization
In 1920 Balthasar van der Pol studied self-sustained oscillations in triode vacuum-tube circuits. The oscillator he described has a nonlinear damping term that injects energy at small amplitudes and dissipates it at large amplitudes — producing a stable limit cycle regardless of initial conditions.
The equation of motion
A single Van der Pol oscillator obeys the second-order ODE:
When two such oscillators are coupled via their displacement difference, the system can synchronise. The coupled equations are:
ẍ₂ − μ(1 − x₂²)ẋ₂ + x₂ = κ(x₁ − x₂)
Phase locking and the Kuramoto model
The Van der Pol coupling is a precursor to the celebrated Kuramoto model, which describes synchronisation in networks of weakly coupled oscillators. The Kuramoto order parameter r = |⟨eiθⱼ⟩| measures global coherence: r = 1 means full synchrony, r ≈ 0 is incoherence. In our two-oscillator system r = |cos(Δφ)| collapses to a single phase difference.
Biological analogy: cardiac pacemakers
Sinoatrial node cells in the heart are tonically self-firing oscillators. Gap junctions couple them electrically. The Van der Pol model (and its relaxation-oscillator cousin, the FitzHugh–Nagumo model) captures how pacemaker cells entrain one another so the entire nodal region fires as a single synchronised wave front — producing the orderly P-wave on an ECG. If coupling fails, independent sub-pacemakers fire at different rates, producing arrhythmia.
In the simulation: start with Δφ = 180° (anti-phase). Increase κ past ~0.5 and watch the phase difference decay to zero (in-phase synchrony). Increase μ to explore relaxation-oscillator territory.
🦠 Bacterial Colony & Chemotaxis
E. coli and many other bacteria navigate chemical gradients using a biased random walk called run-and-tumble. During a "run" the flagella bundle and rotate in unison — the cell swims straight. During a "tumble" the bundle flies apart and the cell reorients randomly. By modulating the switching frequency based on recent signal history, bacteria perform chemotaxis — drifting up gradients of attractants and away from repellents.
The run-and-tumble algorithm
Each bacterium stores position, heading, and a biofilm flag. Every tick:
- Compute the local chemokine gradient at the bacterium's position (bilinear interpolation on the 60×60 grid).
- Tumble probability is reduced when the cell is moving up-gradient: P_tumble ← P_tumble × (1 − bias × cos θ), where θ is the angle between heading and gradient direction.
- If tumbling, choose a new direction biased toward the gradient (±90° cone).
- Move one step; consume a small amount of nutrient from the grid.
Nutrient diffusion
The nutrient field evolves according to a discrete diffusion equation with a central source and zero-flux boundary conditions:
Quorum sensing and biofilm
When many bacteria accumulate in a region the local density can exceed a threshold — a proxy for the concentration of quorum-sensing signalling molecules (N-acyl homoserine lactones in Gram-negative species). Above the threshold cells switch to biofilm mode: motility drops ~15-fold, and they appear orange in the simulation. Biofilms are notoriously resistant to antibiotics because (a) reduced drug penetration and (b) altered metabolic state.
🧬 Genetic Evolution — Natural Selection
Charles Darwin's key insight was that heritable variation in fitness-relevant traits, combined with differential reproduction, is sufficient to produce adaptation. No foresight, no goal — just differential survival and reproduction across generations.
Genome and phenotype
Each creature carries a genome of four floating-point genes, all in [0, 1]:
- Speed — maximum movement velocity. Faster creatures find food sooner but burn more energy.
- Sight — radius in which food is detected. Wider sight costs no energy in this model but competes with other traits through pleiotropy in the selection landscape.
- Efficiency — energy extracted per food item consumed (0.5 – 2.0×).
- Aggression — encoded as the hue of the creature: green = docile, red = aggressive. Currently a neutral marker demonstrating genetic drift and population-level colour evolution.
Tournament selection
To fill the next generation, for each new offspring we draw k individuals at random (the tournament) and select the one with the highest fitness (food eaten). Tournament selection with k = 2 is roughly equivalent to rank selection; k = 8 approaches truncation selection. The tournament size slider controls selection pressure — higher k means fitter individuals dominate faster, at the cost of genetic diversity.
Observing adaptation
With default settings (σ = 0.08, k = 4, moderate food) the mean fitness line in the on-canvas history chart typically rises for the first 10–30 generations, then plateaus near the sustainable foraging rate. Raising the mutation rate adds noise to the chromosome pool, slowing convergence but allowing escape from local optima — a classic exploration/exploitation trade-off. Setting k = 10 produces rapid convergence (high selection pressure) at the cost of premature fixation.
Natural selection is not the only force at work. Watch the aggression gene (creature colour) drift over many generations — if the environment provides no fitness advantage to aggression, its value random-walks toward fixation (either all-green or all-red) due to genetic drift, even with no selection acting on it.