Chapter 4 · Section 6
The Zel'dovich Start
The BPT law
BPT Part 3.11 (The First Ripples) lays down the matter's start as cosmology does. The Zel'dovich Displacement, x = q + D · ψ: "each piece of matter starts at its own place and is moved along the ripples, more as the universe grows", q its place on the even grid it began on, D = a the growth of the ripples, ψ the displacement field, "the gradient of the ripples, pointing toward where the density is higher"; the contrast it makes is δ = −D·∇·ψ. The Growing-Mode Velocity, u = D · H · ψ: "each piece moves with the ripples' growth from the start", so that every ripple is in its growing mode from the first instant ("started at rest instead, half of every ripple would be lost"). In BPT "the ripples are not put in by hand: they are the data", the unevenness of the data on the scaffold, so the web that grows from them "is laid out by the scaffold".
BPT Part 3.12 (The Character of the First Ripples) adds that they are a random field with the Primordial Ripple Spectrum, Δ²(k) = A⊚ · (k / k⊚)^(n⊚ − 1), n⊚ = 0.965, A⊚ = 2.1 × 10⁻⁹ in ours, and that the matter carrying them must begin "not on a grid, whose rows would survive into the web, but as a glass". Part 3.11 then describes this very code: the ripples are "a third the data on the scaffold and two thirds the random field of Part 3.12, smoothed over two cells, on a grid jittered within each cell", scaled "so that, grown linearly, their spread would reach about three by the End of the Outward Expansion", and "ripples longer than a quarter of the universe are left out"; "those three sizes are the simulation's choices here".
The established physics
- Zel'dovich approximation (Zel'dovich 1970): x = q + D(t)·ψ(q), ψ = ∇g with ∇²g = −δ, so δ = −D·∇·ψ; velocities in the growing mode, u = D·H·ψ for D = a.
- Einstein–de Sitter growth, D = a and H = 2/(3t).
- Nearly scale-invariant primordial spectrum, n_s = 0.965 (Planck Collaboration 2020). In two dimensions the amplitude per mode goes as k^((n − 3)/2) (code comment zeldovich.js:24–28).
- Glass initial conditions (White 1996, cited in BPT Part 3.12); the jittered grid is the code's approximation to one.
The game's math
zeldovichStart({ rows, cols, weight, N, aInit, tInit, seed }) zeldovich.js:56, called at app.js:1230 with aInit = expansionA() and tInit = t₀ (Part 4.4).
- The scaffold's contrast. δ_s(x) = weight/mean − 1 (zeldovich.js:65). Each row's own mean is subtracted (zeldovich.js:71), so no band of the torus is preferred (ruling 2026-10-28: "the wells are still gathering around the equator").
- The random field. Gaussian white noise (Box–Muller, zeldovich.js:59) in Fourier space, each mode scaled by k^((N_S − 3)/2) (zeldovich.js:81).
- The mix. Both normalized to unit power, then δ_k = SCAFFOLD_SHARE·δ_s,k/√P_s + (1 − SCAFFOLD_SHARE)·δ_n,k/√P_n (zeldovich.js:84–85), SCAFFOLD_SHARE = 0.35.
- The displacement. For each mode with k² above k_min² (k_min = 2π/(RIPPLE_LONGEST·max(rows, cols)), zeldovich.js:90): smoothing sm = exp(−k²·RIPPLE_SMOOTH²/2); g_k = δ_k·sm/k²; ψ = ∇g = i·k·g_k; back to real space (zeldovich.js:86–97).
- The scale S. The rms of the grid's linear contrast −∇·ψ is measured, and S = RIPPLE_TODAY / rms (zeldovich.js:99–105), so that at a = 1 the contrast would spread to RIPPLE_TODAY = 3.
- The bodies. nc = round(√(N·cols/rows)) columns, nr = round(N/nc) rows; each body at q = ((i + u₁)·rows/nr, (j + u₂)·cols/nc), u random in [0, 1) (the jitter, zeldovich.js:118), then
x = q + D·S·ψ(q), u = D·H·S·ψ(q), D = aInit, H = 2 / (3·max(10⁻⁶, tInit))
ψ is read between cells bilinearly. Each body gets mass q from Part 4.5. The ripples' phases are seeded from the universe's own data (an FNV hash of every third cell, app.js:1229), so the same universe gives the same start.
The rowArea option (zeldovich.js:109–116) puts bodies per row in proportion to each ring's real area; sendOutMatter() does not pass it, since the field is drawn equal-area (app.js:1228).
The method, in plain steps:
contrast ← the scaffold's weight against its mean, each row's own mean removed
mix it with Gaussian random ripples, 35% scaffold and 65% chance, by their power
displacement ψ ← the gradient of (contrast ÷ k²), smoothed, long waves cut
scale it so the contrast would reach 3 at a = 1
each body, on a jittered grid at q: x ← q + a · S · ψ(q), v ← a · H · S · ψ(q)
The code:
// public/game-v8.4/zeldovich.js:56 zeldovichStart()
export function zeldovichStart({ rows, cols, weight, N, aInit, tInit, rowArea = null, seed = 1 }) {
let h0 = (seed >>> 0) || 1;
const rnd = () => { h0 = (h0 + 0x6D2B79F5) >>> 0; let x = h0; x = Math.imul(x ^ (x >>> 15), x | 1); x ^= x + Math.imul(x ^ (x >>> 7), x | 61); return ((x ^ (x >>> 14)) >>> 0) / 4294967296; };
const gauss = () => Math.sqrt(-2 * Math.log(Math.max(1e-12, rnd()))) * Math.cos(2 * Math.PI * rnd());
const n = rows * cols;
let mean = 0; for (let i = 0; i < n; i++) mean += weight[i]; mean /= n;
const gr = new Float64Array(n), gc = new Float64Array(n);
if (mean > 0 && pow2(rows) && pow2(cols)) {
const re = new Float64Array(n), im = new Float64Array(n);
for (let i = 0; i < n; i++) re[i] = weight[i] / mean - 1; /* the scaffold's contrast */
/* ⚠️ NO BAND OF THE TORUS IS PREFERRED (2026-10-28, the author: "the wells are still gathering around the equator"; book Part 3.12,
the first ripples are a random field, and the cosmological principle): the data's layout differs from band to band round
the tube, and that row-wide contrast entered the ripples as one huge mode, so at the big bang the matter already streamed
between bands (measured: 3–6 cells a flip, 5 % of light, away from the outer equator) and by half its life 53 % of it lay
in the band of 60–90° that holds 21 % of the surface. Each row's own mean is taken out: every local ripple stays. */
for (let r = 0; r < rows; r++) { let rm = 0; for (let c = 0; c < cols; c++) rm += re[r * cols + c]; rm /= cols; for (let c = 0; c < cols; c++) re[r * cols + c] -= rm; }
fft2(re, im, rows, cols, false);
/* the random field, in Fourier space: white noise shaped by the spectrum */
const nr2 = new Float64Array(n), ni2 = new Float64Array(n);
for (let i = 0; i < n; i++) nr2[i] = gauss();
fft2(nr2, ni2, rows, cols, false);
let ps = 0, pn = 0;
for (let a = 0; a < rows; a++) for (let b = 0; b < cols; b++) {
const i = a * cols + b, kr = (2 * Math.PI * (a <= rows / 2 ? a : a - rows)) / rows, kc = (2 * Math.PI * (b <= cols / 2 ? b : b - cols)) / cols, k = Math.hypot(kr, kc);
if (k === 0) { nr2[i] = ni2[i] = 0; continue; }
const amp = Math.pow(k, (N_S - 3) / 2); nr2[i] *= amp; ni2[i] *= amp;
ps += re[i] * re[i] + im[i] * im[i]; pn += nr2[i] * nr2[i] + ni2[i] * ni2[i];
}
const ws = ps > 0 ? SCAFFOLD_SHARE / Math.sqrt(ps) : 0, wn = pn > 0 ? (1 - SCAFFOLD_SHARE) / Math.sqrt(pn) : 0;
for (let i = 0; i < n; i++) { re[i] = re[i] * ws + nr2[i] * wn; im[i] = im[i] * ws + ni2[i] * wn; }
const Rr = new Float64Array(n), Ri = new Float64Array(n), Cr = new Float64Array(n), Ci = new Float64Array(n);
for (let a = 0; a < rows; a++) for (let b = 0; b < cols; b++) {
const i = a * cols + b, kr = (2 * Math.PI * (a <= rows / 2 ? a : a - rows)) / rows, kc = (2 * Math.PI * (b <= cols / 2 ? b : b - cols)) / cols, k2 = kr * kr + kc * kc;
if (k2 === 0) continue;
const kmin = 2 * Math.PI / (RIPPLE_LONGEST * Math.max(rows, cols)); if (k2 < kmin * kmin) continue; /* no ripple longer than RIPPLE_LONGEST of the field */
const sm = Math.exp(-k2 * RIPPLE_SMOOTH * RIPPLE_SMOOTH / 2); /* smoothed over RIPPLE_SMOOTH cells */
const g_r = re[i] * sm / k2, g_i = im[i] * sm / k2; /* g_k = δ_k / k² (∇²g = −δ) */
Rr[i] = -kr * g_i; Ri[i] = kr * g_r; /* ψ = ∇g: i·k·g_k */
Cr[i] = -kc * g_i; Ci[i] = kc * g_r;
}
…
In the game
At the burst the sky looks smooth: the bodies sit almost evenly over the torus where the data was, slightly thicker along the lattice's lines. Nothing turns yet. Over the first part of the life the player watches the ripples grow: matter drains from the voids and gathers along the lattice's lines into filaments, with knots where lines cross. The first toast of the growth names it at a = 0.25: "a quarter grown: The universe is a quarter of its final size · the ripples are growing: the first clumps gather along the lattice's lines" (app.js:671). In 3D the lattice still shows faintly under the stars (Part 4.5), so the player can see the web following it.
The contrast can be read directly in the 2D field with "Colour by → Density" (index.php:189–190): each cell is colored by the matter's density on the gravity mesh, from dark blue where there is none to bright orange at a cloud's mass or more, hsl(0.66 − 0.55·ρ, 0.9, 0.1 + 0.55·ρ) with ρ the block's matter over one cloud's mass, at most 1 (app.js:364–367, sample() matter.js:520). No control changes the start: its sizes are the simulation's choices, and its phases come from the universe's own data.
The scale model
The ripples are laid on the drawn field at the drawn resolution; ripples shorter than about two cells are smoothed away and longer than a quarter of the field dropped. The spread RIPPLE_TODAY is set against the end of the life, so the web is formed by the End of the Outward Expansion on every field. The start is a scale model of the shape of the web, not of its amplitude in our universe (A⊚ ≈ 2.1 × 10⁻⁹ in BPT Part 3.12 is not used).
Where the game and the theory differ
- A third, or 0.35. BPT Part 3.11 says the ripples are a third the scaffold's and two thirds the random field's; the code's
SCAFFOLD_SHAREis 0.35 of the amplitude, each part normalized to unit power first. - A jittered grid, not a glass. BPT Part 3.12 says the matter must begin as a glass, with no preferred direction; the code, as Part 3.11's reading of it says, lays the bodies on a regular grid jittered within each cell, an approximation to one.
Fixed numbers
| Number | Where | What it is | Kind |
|---|---|---|---|
| 3 | RIPPLE_TODAY zeldovich.js:16 |
Linear contrast the ripples would reach at a = 1 | METHOD (named choice: web formed by the end) |
| 2 | RIPPLE_SMOOTH zeldovich.js:18 |
Smoothing width, cells | METHOD (named choice: width of the lattice's lines) |
| 0.25 | RIPPLE_LONGEST zeldovich.js:23 |
Longest ripple kept, share of the field | METHOD (named choice; universe smooth on its largest scales) |
| 0.965 | N_S zeldovich.js:28 |
Spectral index | PHYSICS (Planck Collaboration 2020) |
| 0.35 | SCAFFOLD_SHARE zeldovich.js:28 |
Share of the ripples' strength from the scaffold | METHOD (named choice; BPT 3.11 says "a third") |
| 3, 2 | zeldovich.js:81 | Amplitude exponent (n − 3)/2 in two dimensions | PHYSICS (2D power spectrum) |
| 2, 3 | zeldovich.js:106 | H = 2/(3t) | PHYSICS (Einstein–de Sitter) |
| 10⁻⁶ | zeldovich.js:106 | Floor on tInit | METHOD |
| 10⁻¹² | zeldovich.js:59 | Floor in the Box–Muller log | METHOD |
| 0x6D2B79F5, 15, 7, 14, 61, 4294967296 | zeldovich.js:58 | Seeded random generator (mulberry-style) | METHOD (reproducible draws) |
| 1 | zeldovich.js:56 | Default seed | METHOD |