Cosmology — Friedmann models, density parameters, and the CMB
One equation and four numbers — the density parameters Ω_m (matter), Ω_Λ (dark energy), Ω_r (radiation), and Ω_k (curvature), each measuring that component's share of the universe's total energy density — determine whether the universe expands forever, decelerates into a slow coast, or someday collapses back on itself. The oldest light in the sky, cooled to 2.725 kelvin, is how we measured those numbers — and it is simple enough to render as a procedural sky map.
1. The Friedmann equations
Applying Einstein's field equations to a universe assumed to be homogeneous and isotropic (the cosmological principle) yields the Friedmann equations, derived independently by Alexander Friedmann in 1922 and Georges Lemaître in 1927. The first equation relates the expansion rate to the universe's energy content:
a(t) — scale factor, normalised to a=1 today
ȧ/a = H(t) — Hubble parameter, expansion rate
ρ — total energy density (matter + radiation)
k — spatial curvature (+1, 0, −1)
Λ — cosmological constant (dark energy)
In plain terms: the expansion rate squared is set by how much "stuff" (matter, radiation, dark energy) is in the universe, minus a term for spatial curvature. Everything about the universe's large-scale fate follows from this one relation.
2. Density parameters: Ω_m, Ω_Λ, Ω_r, Ω_k
It's convenient to divide through by the critical density ρ_crit — the exact density that would make space spatially flat (k=0) — and define dimensionless density parameters for each component:
Ω_m = ρ_matter / ρ_crit ← dark + baryonic matter
Ω_r = ρ_radiation / ρ_crit ← photons + neutrinos
Ω_Λ = ρ_Λ / ρ_crit ← dark energy / cosmological constant
Ω_k = 1 − (Ω_m + Ω_r + Ω_Λ) ← curvature term
The Friedmann equation then rewrites into a clean, unit-free form used directly in simulations:
Modern measurements (Planck satellite, 2018) place our universe at roughly:
| Component | Ω value | Scaling with a | Dominates when |
|---|---|---|---|
| Radiation, Ω_r | ≈ 9 × 10⁻⁵ | a⁻⁴ | First ~50 000 years |
| Matter, Ω_m | ≈ 0.315 | a⁻³ | ~50 000 yr – 9.8 Gyr |
| Dark energy, Ω_Λ | ≈ 0.685 | constant | ~9.8 Gyr – today & beyond |
| Curvature, Ω_k | ≈ 0 (flat, within error) | a⁻² | Never (so far) |
3. Three fates: open, flat, closed
The sign of the curvature term Ω_k, and the long-term balance between matter and dark energy, determines the universe's large-scale geometry and ultimate fate:
- Closed (k=+1, Ω_total > 1): spherical geometry. Without dark energy this would eventually stop expanding and recollapse in a "Big Crunch". With a positive Λ as we actually observe, even a slightly closed universe still expands forever.
- Flat (k=0, Ω_total = 1): Euclidean geometry — parallel lines never meet, the angles of a triangle sum to 180°. Current data are consistent with our universe being flat to within about 0.4%.
- Open (k=−1, Ω_total < 1): hyperbolic (saddle-shaped) geometry, expanding forever regardless of dark energy.
Because Ω_Λ is positive and dominates today, our particular universe is in accelerating expansion regardless of which of these three geometries turns out to be exactly correct — the observed near-flatness is a separate, additional finding.
4. The scale factor through cosmic history
Integrating H(a) = ȧ/a numerically (there is no simple
closed form once all four components are included) traces out
a(t), the scale factor as a function of cosmic time —
effectively "how big is the universe" at each moment, normalised
to 1 today.
// Numerically integrate the Friedmann equation for a(t)
function integrateScaleFactor(H0, omegaR, omegaM, omegaK, omegaL, tMaxGyr, steps = 2000) {
const dt = tMaxGyr / steps;
let a = 1e-8; // start deep in the radiation era
const track = [{ t: 0, a }];
for (let i = 1; i <= steps; i++) {
const H = H0 * Math.sqrt(
omegaR * Math.pow(a, -4) +
omegaM * Math.pow(a, -3) +
omegaK * Math.pow(a, -2) +
omegaL
);
a += a * H * dt; // da/dt = a * H(a)
track.push({ t: i * dt, a });
}
return track;
}
Three regimes fall naturally out of this integration: a ∝
t^(1/2) during the radiation-dominated era,
a ∝ t^(2/3) during matter domination, and
a ∝ e^(Ht) (exponential) once dark energy takes over
— the phase the universe entered a few billion years ago and
which will define its distant future.
5. The cosmic microwave background
For its first ~380 000 years, the universe was a hot, dense plasma of free electrons and photons, opaque to light (photons scattered off free electrons constantly — Thomson scattering). As the universe expanded and cooled below ~3000 K, electrons combined with protons to form neutral hydrogen (recombination), and photons suddenly travelled freely — the universe became transparent.
Those photons, redshifted by the subsequent 13.8 billion years of
expansion, arrive today as the cosmic microwave
background (CMB): a near-perfect blackbody spectrum at
T = 2.725 K, filling the entire sky almost uniformly.
Discovered accidentally by Penzias and Wilson in 1965 (earning the
1978 Nobel Prize), the CMB is the oldest light we can observe —
a direct baby picture of the universe.
6. Anisotropies and the power spectrum
The CMB is not perfectly uniform: tiny temperature fluctuations of
about ΔT/T ~ 10⁻⁵ (one part in 100 000) map out
density variations in the early universe — the seeds that would
later grow, under gravity, into galaxies and galaxy clusters.
Decomposing these fluctuations into spherical harmonics produces the angular power spectrum: a plot of fluctuation strength versus angular scale, showing a series of acoustic peaks caused by sound waves in the photon-baryon plasma before recombination. The position and height of these peaks encode Ω_m, Ω_b (baryon density), Ω_k, and the Hubble constant with remarkable precision — this is how missions like WMAP and Planck actually measured the Ω values in the table above.
7. Simulating a CMB sky map in Three.js
The CMB simulation on this site renders the temperature fluctuations as a procedurally generated texture mapped onto the inside of a sphere (an equirectangular "sky map" the camera sits inside of), coloured on the familiar red/blue Planck-mission scale.
// Generate a procedural CMB-like temperature map using layered simplex noise
function generateCMBTexture(width = 1024, height = 512) {
const data = new Uint8Array(width * height * 4);
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
// Multiple octaves — mimics the acoustic-peak angular scales
let t = 0, amp = 1, freq = 1;
for (let o = 0; o < 5; o++) {
t += amp * simplex2(x * 0.01 * freq, y * 0.01 * freq);
amp *= 0.55; freq *= 2.1;
}
// Map t (~[-1,1]) to a red-blue temperature colour scale
const idx = (y * width + x) * 4;
const warm = Math.max(0, t);
const cool = Math.max(0, -t);
data[idx] = 128 + warm * 127; // R
data[idx+1] = 128 - Math.abs(t) * 60; // G
data[idx+2] = 128 + cool * 127; // B
data[idx+3] = 255;
}
}
return new THREE.DataTexture(data, width, height, THREE.RGBAFormat);
}
const skyGeo = new THREE.SphereGeometry(500, 64, 32);
const skyMat = new THREE.MeshBasicMaterial({
map: generateCMBTexture(),
side: THREE.BackSide, // camera sits inside the sphere
});
scene.add(new THREE.Mesh(skyGeo, skyMat));
A separate 2D canvas overlay draws the angular power spectrum plot, letting users compare a toy Ω_m/Ω_Λ slider against a reference acoustic-peak curve to build intuition for how the density parameters shift peak positions and heights.
8. Extensions and improvements
- Interactive Ω sliders: expose Ω_m, Ω_Λ and Ω_k as sliders driving both the scale-factor integration and the rendered universe-fate label (expand forever / recollapse / marginal).
- Redshift-time overlay: annotate the a(t) curve with key epochs — recombination (z≈1100), matter-Λ equality (z≈0.3), and today — tying the abstract curve to the CMB and observable galaxies.
- Baryon acoustic oscillations (BAO): extend the simulation to show the "frozen" imprint of the same sound waves in the present-day distribution of galaxies — a second, independent line of evidence for the same Ω values.
- Real Planck data overlay: replace the procedural noise texture with (a downsampled version of) actual public Planck CMB temperature maps for direct comparison against the simulated toy universe.
🌌 CMB — Cosmic Microwave Background
The live simulation renders a procedural CMB sky map with an angular power spectrum, and lets you explore how Ω_m and Ω_Λ shape the universe's expansion history.