Cosmology and the Large-Scale Structure of the Universe

Last Updated May 28, 2026

Cosmology studies the universe as a physical system: its origin, expansion, composition, geometry, thermal history, structure formation, and large-scale distribution of matter. It asks how a nearly homogeneous early universe evolved into the cosmic web of galaxies, clusters, voids, filaments, dark matter halos, hot gas, stars, black holes, and gravitationally bound structures observed today. Modern cosmology is therefore both a theory of spacetime and a data-driven science of maps: maps of the cosmic microwave background, galaxy clustering, weak gravitational lensing, baryon acoustic oscillations, supernova distances, gravitational waves, and numerical simulations.

The central model of contemporary cosmology is the spatially flat ΛCDM framework: a universe governed on large scales by general relativity, ordinary baryonic matter, cold dark matter, radiation, neutrinos, primordial perturbations, and dark energy often modeled as a cosmological constant. Its success is extraordinary. A small number of parameters explains the cosmic microwave background, light-element abundances, large-scale galaxy clustering, baryon acoustic oscillations, gravitational lensing, and the broad history of cosmic expansion. Yet cosmology remains unsettled at its frontiers: the nature of dark matter is unknown, the physical origin of dark energy remains unclear, inflation is strongly motivated but not uniquely identified, and tensions among early- and late-universe measurements continue to motivate new observations and theoretical alternatives.

This article develops Cosmology and the Large-Scale Structure of the Universe as a research-grade introduction within the Physics knowledge series. It explains the cosmological principle, FLRW spacetime, scale factor, redshift, Hubble expansion, Friedmann equations, cosmic density parameters, radiation, baryons, cold dark matter, dark energy, inflation, primordial perturbations, the cosmic microwave background, acoustic peaks, baryon acoustic oscillations, galaxy surveys, weak lensing, large-scale structure, cosmic web morphology, linear perturbation growth, transfer functions, matter power spectra, halo formation, N-body simulations, hydrodynamic simulations, parameter inference, current observational tensions, and the future of survey cosmology. Selected R and Python workflows appear in the article body, while the companion GitHub repository contains expanded computational examples for FLRW expansion, distance-redshift relations, growth functions, toy matter power spectra, BAO scales, survey metadata, simulation summaries, SQL provenance tables, C/C++/Fortran/Rust examples, and reproducible cosmology workflows.

Editorial scientific illustration showing an expansive cosmic web of galaxies, clusters, filaments, voids, dark matter halo structures, cosmic microwave background texture, redshift-depth geometry, lensing arcs, and survey-map forms.
Cosmology studies the universe as a physical system, linking cosmic expansion, dark matter, dark energy, the cosmic microwave background, galaxy surveys, and the large-scale structure of the cosmic web.

Why Cosmology Matters

Cosmology matters because it places all physical systems inside their largest context. Stars, galaxies, black holes, planetary systems, heavy elements, radiation backgrounds, dark matter halos, and biological worlds all arise within a universe that expands, cools, structures itself gravitationally, and evolves across cosmic time. Cosmology is therefore not only the study of distant galaxies. It is the study of the background conditions that make galaxies, chemistry, planets, and life historically possible.

The field also matters because it tests physics at extreme scales. Cosmology uses general relativity on horizon-sized domains, nuclear physics in Big Bang nucleosynthesis, plasma physics in the early universe, statistical mechanics in thermal history, quantum field theory in inflationary perturbations, particle physics in dark matter and neutrino constraints, and computational physics in large-scale simulations. Few scientific fields require such a broad synthesis of theory, observation, and computation.

Modern cosmology is also a measurement science. The cosmic microwave background records conditions when the universe became transparent. Baryon acoustic oscillations preserve the imprint of early-universe sound waves in the distribution of galaxies. Supernovae measure the distance-redshift relation. Weak lensing maps the integrated matter distribution. Galaxy surveys reconstruct the cosmic web. Each probe has different systematics, and cosmological inference depends on their consistency.

Cosmology is therefore both grand and exacting. It asks questions about the origin and fate of the universe, but it answers them through calibration, covariance matrices, maps, redshift catalogs, likelihoods, numerical simulations, foreground models, and parameter inference. The scale of the subject does not remove the need for methodological discipline. It makes methodological discipline unavoidable.

For the Physics knowledge series, this article belongs near General Relativity: Geometry, Gravity, and Spacetime Curvature, Statistical Physics and the Emergence of Macroscopic Order, Quantum Field Theory I: Fields, Particles, and Second Quantization, Phase Transitions, Critical Phenomena, and the Renormalization Group, Many-Body Physics and Emergent Collective Behavior, Computational Physics and Scientific Simulation, and Climate Physics and Planetary Energy Balance. Cosmology extends physical reasoning from local systems to the observable universe as a whole.

Back to top ↑

The Cosmological Principle

The cosmological principle states that, on sufficiently large scales, the universe is approximately homogeneous and isotropic. Homogeneity means that the universe has no preferred position. Isotropy means that it has no preferred direction. This principle does not claim that the universe is smooth on every scale. Galaxies, clusters, filaments, and voids clearly exist. Rather, it claims that when averaged over very large volumes, the universe can be modeled as statistically uniform.

This assumption is powerful because it turns the full complexity of spacetime into a tractable background model. Instead of requiring a completely arbitrary metric, cosmology can begin with a highly symmetric spacetime whose evolution is described by a single scale factor \(a(t)\). Perturbations around this background then describe the formation of structure.

The cosmological principle is supported by the large-scale uniformity of the cosmic microwave background and by the statistical distribution of galaxies at very large scales. It is not a metaphysical axiom. It is an empirical approximation, tested by observations and used because it works remarkably well in the regime where it is intended to apply.

The distinction between background and perturbation is central. The background universe expands smoothly. Perturbations grow gravitationally. Cosmology is therefore a two-level theory: first, the evolution of the homogeneous background; second, the evolution of fluctuations that become galaxies and large-scale structure.

This distinction also prevents a common misunderstanding. Cosmology does not deny local complexity. It explains how local complexity emerges from small perturbations within a statistically simple large-scale background. The universe can be homogeneous in a statistical sense while still containing stars, galaxies, clusters, voids, and observers.

Back to top ↑

FLRW Spacetime and the Scale Factor

The spacetime geometry associated with homogeneity and isotropy is the Friedmann–Lemaître–Robertson–Walker metric. In a common form:

\[
ds^2
=
-c^2dt^2
+
a(t)^2
\left[
\frac{dr^2}{1-kr^2}
+
r^2d\Omega^2
\right]
\]

Interpretation: The FLRW metric represents a homogeneous and isotropic expanding universe through the scale factor \(a(t)\).

where \(a(t)\) is the scale factor, \(k\) describes spatial curvature, \(c\) is the speed of light, and \(d\Omega^2\) is the angular part of the metric. The scale factor describes how distances between comoving points change with cosmic time.

Comoving coordinates expand with the universe. A galaxy at fixed comoving coordinate can still have increasing physical distance from another comoving galaxy because the scale factor grows. The physical separation \(D(t)\) between two comoving points is:

\[
D(t)=a(t)\chi
\]

Interpretation: Physical distance equals scale factor times comoving separation.

where \(\chi\) is comoving separation. The scale factor is often normalized so that today:

\[
a_0=1
\]

Interpretation: Cosmologists commonly normalize the present-day scale factor to one.

Earlier epochs have \(a<1\). The redshift \(z\) is related to the scale factor by:

\[
1+z=\frac{a_0}{a}
\]

Interpretation: Redshift measures the relative change in scale factor between emission and observation.

With \(a_0=1\), this becomes:

\[
a=\frac{1}{1+z}
\]

Interpretation: Higher redshift corresponds to a smaller scale factor and earlier cosmic epoch.

This relation makes redshift a direct observational proxy for cosmic scale factor and, through a cosmological model, cosmic time.

The scale factor is not an ordinary material stretching through pre-existing space. In general relativity, the geometry itself evolves. This is why cosmological distance measures require care: proper distance, comoving distance, luminosity distance, angular diameter distance, and light-travel time are related but not interchangeable.

Back to top ↑

Redshift and Cosmic Expansion

Cosmological redshift occurs because light waves are stretched by the expansion of space. If a photon is emitted with wavelength \(\lambda_{\mathrm{emit}}\) and observed with wavelength \(\lambda_{\mathrm{obs}}\), the redshift is:

\[
1+z
=
\frac{\lambda_{\mathrm{obs}}}{\lambda_{\mathrm{emit}}}
\]

Interpretation: Redshift is the ratio of observed wavelength to emitted wavelength.

Because wavelength stretches with the scale factor:

\[
1+z
=
\frac{a(t_0)}{a(t_{\mathrm{emit}})}
\]

Interpretation: Cosmological redshift tracks how much the universe expanded while light was traveling.

For nearby galaxies, Hubble’s law relates recession velocity to distance:

\[
v \approx H_0 D
\]

Interpretation: At low redshift, recessional velocity is approximately proportional to distance.

where \(H_0\) is the Hubble constant today. At cosmological distances, this linear approximation is insufficient; one must use the full expansion history and relativistic distance measures.

The Hubble parameter is defined as:

\[
H(t)=\frac{\dot{a}(t)}{a(t)}
\]

Interpretation: The Hubble parameter measures the instantaneous fractional expansion rate.

It measures the instantaneous fractional expansion rate of the universe. Cosmological observations often constrain \(H(z)\), the Hubble parameter as a function of redshift, rather than only \(H_0\).

Redshift should not be reduced to an ordinary Doppler shift, although peculiar velocities can contribute to observed redshift. Cosmological redshift reflects the changing scale factor between emission and observation. A galaxy’s observed redshift may contain cosmic expansion, local gravitational effects, and peculiar motion. Precision cosmology must separate these contributions statistically.

Back to top ↑

Friedmann Equations

The Friedmann equations describe the expansion of a homogeneous and isotropic universe in general relativity. The first Friedmann equation can be written as:

\[
H^2
=
\frac{8\pi G}{3}\rho

\frac{kc^2}{a^2}
+
\frac{\Lambda c^2}{3}
\]

Interpretation: The expansion rate depends on total energy density, spatial curvature, and the cosmological constant.

where \(\rho\) is total energy density, \(G\) is Newton’s gravitational constant, \(k\) is spatial curvature, and \(\Lambda\) is the cosmological constant.

The acceleration equation is:

\[
\frac{\ddot{a}}{a}
=
-\frac{4\pi G}{3}
\left(
\rho+\frac{3p}{c^2}
\right)
+
\frac{\Lambda c^2}{3}
\]

Interpretation: Cosmic acceleration depends on both energy density and pressure.

This equation shows that pressure gravitates. Radiation, matter, and dark energy affect expansion differently because they have different equations of state.

A useful equation-of-state parameter is:

\[
w=\frac{p}{\rho c^2}
\]

Interpretation: The equation-of-state parameter compares pressure with energy density.

For nonrelativistic matter:

\[
w=0
\]

Interpretation: Nonrelativistic matter has negligible pressure relative to energy density.

For radiation:

\[
w=\frac{1}{3}
\]

Interpretation: Radiation pressure is one third of its energy density in relativistic units.

For a cosmological constant:

\[
w=-1
\]

Interpretation: A cosmological constant has negative pressure equal in magnitude to its energy density.

Cosmic acceleration occurs when the effective pressure is sufficiently negative. This is why dark energy is not merely “extra energy.” Its pressure-like behavior is central to its gravitational effect.

The Friedmann equations also show why cosmology is not a free narrative about cosmic history. Once the matter-energy contents and geometry are specified, the expansion history is mathematically constrained. Observations then test whether that constrained history matches the universe we measure.

Back to top ↑

ΛCDM: The Standard Cosmological Model

ΛCDM is the standard model of cosmology. The symbol \(\Lambda\) represents the cosmological constant, and CDM represents cold dark matter. The model assumes a universe whose large-scale expansion is governed by general relativity, whose dominant matter component is nonrelativistic and weakly interacting, and whose accelerated expansion is driven by an energy component behaving like a cosmological constant.

In a spatially flat ΛCDM model, the dimensionless expansion function is:

\[
E(z)
=
\frac{H(z)}{H_0}
=
\sqrt{
\Omega_r(1+z)^4
+
\Omega_m(1+z)^3
+
\Omega_\Lambda
}
\]

Interpretation: Radiation, matter, and dark energy contribute differently to the expansion rate as redshift changes.

where \(\Omega_r\), \(\Omega_m\), and \(\Omega_\Lambda\) are the present-day radiation, matter, and dark-energy density parameters. At late times, radiation is often negligible for low-redshift distance calculations, giving:

\[
E(z)
\approx
\sqrt{
\Omega_m(1+z)^3
+
\Omega_\Lambda
}
\]

Interpretation: At low redshift, matter and dark energy often dominate the expansion history.

ΛCDM is successful because it fits many independent observations with a small parameter set: CMB anisotropies, baryon acoustic oscillations, Type Ia supernovae, galaxy clustering, weak lensing, and large-scale structure. Its success does not mean it is complete. It is a phenomenological framework with unresolved physical components: dark matter and dark energy are inferred gravitationally, but their fundamental nature remains unknown.

The power of ΛCDM is also the source of its vulnerability. Because the model is tightly constrained, small inconsistencies between independent probes can become scientifically significant. If the same parameter set cannot fit early-universe measurements, late-universe distances, structure growth, lensing, and galaxy clustering, the result may indicate hidden systematics, incomplete astrophysical modeling, or new physics.

Back to top ↑

Radiation, Baryons, Dark Matter, and Dark Energy

The universe contains several components that scale differently with expansion. Radiation energy density scales as:

\[
\rho_r \propto a^{-4}
\]

Interpretation: Radiation dilutes with volume and loses photon energy through redshift.

The extra factor of \(a^{-1}\), beyond dilution by volume, comes from redshifting photon energy. Nonrelativistic matter scales as:

\[
\rho_m \propto a^{-3}
\]

Interpretation: Nonrelativistic matter density falls as volume expands.

because particle number density dilutes as volume expands. A cosmological constant has constant energy density:

\[
\rho_\Lambda=\mathrm{constant}
\]

Interpretation: A cosmological constant does not dilute as the universe expands.

Baryons are ordinary matter: protons, neutrons, nuclei, atoms, gas, stars, planets, and biological material. Dark matter is nonluminous matter inferred from gravitational effects: galaxy rotation curves, cluster dynamics, gravitational lensing, CMB anisotropies, and structure formation. Dark energy is the component responsible for late-time cosmic acceleration in the standard model.

The relative importance of these components changes over cosmic time. The early universe was radiation dominated. Later it became matter dominated, allowing gravitational structure to grow efficiently. At late times, dark energy became dynamically important and accelerated expansion.

This time dependence is central to cosmological inference. Different observations probe different epochs and therefore different component balances. The CMB probes a radiation-to-matter transition world. Galaxy clustering probes matter-dominated and dark-energy-influenced epochs. Supernovae and BAO probe the late-time expansion history. Weak lensing integrates matter structure along the line of sight. A successful cosmological model must connect all of these regimes consistently.

Back to top ↑

Thermal History of the Universe

The universe cools as it expands. In the early radiation-dominated era, temperature scales approximately as:

\[
T \propto \frac{1}{a}
\]

Interpretation: Radiation temperature falls as the scale factor grows.

At extremely early times, the universe was hot, dense, and opaque. As it expanded, different physical processes froze out or became possible. Big Bang nucleosynthesis formed light elements such as hydrogen, helium, and trace lithium. Recombination allowed electrons and nuclei to form neutral atoms. Photon decoupling released the cosmic microwave background. Later, the first stars and galaxies formed, reionizing much of the intergalactic medium.

Important epochs include inflation, reheating, radiation domination, nucleosynthesis, matter-radiation equality, recombination, photon decoupling, dark ages, first star formation, reionization, galaxy formation, dark-energy domination, and the present accelerating universe.

Thermal history links cosmology to particle physics, nuclear physics, atomic physics, radiation transport, plasma physics, and gravitational structure formation. Cosmology is therefore not only geometry. It is also the physical history of matter, radiation, and fields.

Thermal history is also a sequence of changing degrees of freedom. At high temperatures, particles and fields may remain in equilibrium. As expansion lowers temperatures and densities, interactions freeze out, species decouple, nuclei form, atoms form, photons free-stream, and gravitational structure becomes dominant. The expanding universe is therefore a cooling laboratory whose “experiments” are recorded in relic abundances, radiation backgrounds, and large-scale structure.

Back to top ↑

Inflation and Primordial Perturbations

Inflation is a hypothesized period of extremely rapid early expansion. It was proposed to explain why the universe appears spatially flat, homogeneous, isotropic, and free of unwanted relics over observable scales. Inflation also provides a mechanism for generating primordial perturbations from quantum fluctuations stretched to cosmic scales.

The expansion during inflation is often characterized by accelerated growth of the scale factor:

\[
\ddot{a}>0
\]

Interpretation: Inflation requires accelerated expansion of the scale factor.

A simple inflationary condition is that the energy density is dominated by a component with sufficiently negative pressure. In scalar-field models, an inflaton field \(\phi\) slowly rolls down a potential \(V(\phi)\). The energy density and pressure are:

\[
\rho_\phi
=
\frac{1}{2}\dot{\phi}^2+V(\phi)
\]

Interpretation: Scalar-field energy density combines kinetic and potential energy.

\[
p_\phi
=
\frac{1}{2}\dot{\phi}^2-V(\phi)
\]

Interpretation: Scalar-field pressure becomes negative when potential energy dominates.

When potential energy dominates, \(p_\phi\approx-\rho_\phi c^2\), leading to accelerated expansion.

Primordial perturbations are often described statistically by a power spectrum. For curvature perturbations \(\mathcal{R}\):

\[
P_\mathcal{R}(k)
=
A_s
\left(
\frac{k}{k_*}
\right)^{n_s-1}
\]

Interpretation: The primordial curvature power spectrum describes fluctuation amplitude across spatial scale.

where \(A_s\) is the scalar amplitude, \(n_s\) is the scalar spectral index, and \(k_*\) is a pivot scale. CMB observations strongly constrain these parameters. The observed near-scale-invariance of primordial perturbations is one of the strongest empirical motivations for inflationary physics, though the specific inflationary model remains unsettled.

Inflation should therefore be presented as a powerful framework rather than a single completed theory. Many models can generate similar perturbation spectra. Observables such as tensor modes, non-Gaussianity, spectral running, reheating signatures, and primordial features help narrow possibilities, but the underlying high-energy physics remains open.

Back to top ↑

Cosmic Microwave Background

The cosmic microwave background is the relic radiation from the epoch when the universe became transparent to photons. Before recombination, photons, electrons, and baryons formed a tightly coupled plasma. After electrons combined with nuclei to form neutral atoms, photons decoupled and traveled largely freely through the universe.

The CMB is nearly a perfect blackbody, with tiny anisotropies at the level of roughly one part in \(10^5\). These anisotropies encode information about the early universe: density perturbations, acoustic oscillations, spatial curvature, baryon density, dark matter density, optical depth, scalar spectral index, and the amplitude of primordial fluctuations.

The angular power spectrum of CMB temperature anisotropies is commonly written as:

\[
C_\ell
=
\langle |a_{\ell m}|^2\rangle
\]

Interpretation: The CMB angular power spectrum measures fluctuation strength at angular multipole \(\ell\).

where \(a_{\ell m}\) are spherical harmonic coefficients of the temperature field. The acoustic peaks in \(C_\ell\) arise from oscillations in the photon-baryon plasma before recombination. Their positions and amplitudes provide precise cosmological constraints.

The CMB is central because it gives a snapshot of the universe when it was young, simple, and close to linear. Large-scale structure shows how those initial fluctuations evolved gravitationally into the nonlinear cosmic web.

The CMB is also a foreground and calibration problem. Galactic dust, synchrotron emission, point sources, lensing, beam systematics, polarization calibration, and instrument noise must be modeled carefully. Precision cosmology depends on extracting a primordial and early-universe signal from a sky filled with local and astrophysical contaminants.

Back to top ↑

Baryon Acoustic Oscillations

Baryon acoustic oscillations are relic sound-wave features from the early photon-baryon plasma. Before recombination, radiation pressure and gravity produced acoustic waves. After recombination, photons decoupled while baryonic matter retained a preferred clustering scale inherited from the sound horizon.

In the galaxy distribution, BAO appears as a weak excess probability of finding galaxy pairs separated by a characteristic comoving scale. It functions as a standard ruler. By measuring the apparent BAO scale at different redshifts, cosmologists constrain the expansion history.

The comoving angular diameter distance and Hubble parameter enter BAO measurements differently transverse and along the line of sight. Schematically:

\[
\theta_{\mathrm{BAO}}
\sim
\frac{r_d}{D_M(z)}
\]

Interpretation: The transverse BAO angle depends on the sound horizon divided by transverse comoving distance.

and:

\[
\Delta z_{\mathrm{BAO}}
\sim
\frac{H(z)r_d}{c}
\]

Interpretation: The radial BAO redshift interval depends on the expansion rate and sound horizon scale.

where \(r_d\) is the sound horizon scale, \(D_M(z)\) is transverse comoving distance, and \(H(z)\) is the expansion rate. BAO therefore connects early-universe physics to late-time cosmic expansion.

BAO is powerful because it is comparatively robust, but it is not automatic. Survey geometry, redshift errors, nonlinear clustering, reconstruction methods, galaxy bias, covariance estimation, and fiducial cosmology choices all affect the measurement. The standard ruler is physical, but the inference requires careful statistical machinery.

Back to top ↑

Galaxy Surveys and Redshift Space

Galaxy surveys map the three-dimensional distribution of matter using angular positions and redshifts. A galaxy’s redshift contains both cosmological expansion and peculiar velocity. This means observed redshift-space clustering is distorted by velocities, producing redshift-space distortions that encode information about structure growth and gravity.

Large surveys such as SDSS, DES, DESI, Euclid, and the Vera C. Rubin Observatory’s Legacy Survey of Space and Time are central to modern cosmology. Spectroscopic surveys measure precise redshifts for galaxies and quasars. Photometric surveys observe many more objects but with less precise redshift estimates. Weak-lensing surveys measure coherent distortions in galaxy shapes caused by intervening matter.

Survey cosmology is fundamentally statistical. Individual galaxies are astrophysically complex and biased tracers of the matter field. But their large-scale correlations reveal the imprint of primordial perturbations, gravitational growth, cosmic expansion, and dark energy.

Redshift-space distortions are especially important because they connect clustering to velocity fields. Peculiar velocities arise from gravitational infall into overdense regions. Measuring anisotropic clustering in redshift space can therefore constrain the growth rate of structure and test whether gravity behaves as expected on cosmological scales.

Survey maps are also selection functions. A catalog is not the universe itself. It is the universe filtered through target selection, masks, depth variations, observing conditions, photometric calibration, spectroscopic completeness, redshift failures, star-galaxy separation, and analysis choices. Serious cosmological inference must model the survey as well as the cosmos.

Back to top ↑

Large-Scale Structure and the Cosmic Web

Large-scale structure is the observed pattern of matter in the universe: galaxies and dark matter halos arranged in filaments, sheets, clusters, and voids. This structure is often called the cosmic web. It emerges from gravitational amplification of tiny early density perturbations.

The density contrast is defined as:

\[
\delta(\mathbf{x},t)
=
\frac{\rho(\mathbf{x},t)-\bar{\rho}(t)}{\bar{\rho}(t)}
\]

Interpretation: Density contrast measures fractional overdensity or underdensity relative to the cosmic mean.

When \( |\delta| \ll 1 \), perturbations are linear and can often be treated analytically. When \( |\delta| \ge 1 \), nonlinear gravitational collapse becomes important, producing halos, filaments, virialized systems, and complex baryonic processes.

The cosmic web is not random visual complexity. It is the outcome of gravitational instability in an expanding universe. Dense regions attract more matter, voids evacuate, and anisotropic collapse produces sheets and filaments before forming halos. This is why cosmology depends on both perturbation theory and numerical simulation.

The cosmic web is also a record of competing processes. Gravity amplifies perturbations, expansion dilutes and damps growth, dark energy suppresses late-time collapse, baryonic feedback redistributes gas, and galaxy formation changes the visible tracers. The observed web is therefore both a cosmological signal and an astrophysical product.

Back to top ↑

Linear Growth of Structure

In the linear regime, matter perturbations grow according to an equation of the form:

\[
\ddot{\delta}
+
2H\dot{\delta}

4\pi G\bar{\rho}_m\delta
=
0
\]

Interpretation: Linear perturbation growth balances gravitational attraction against expansion damping.

The term \(2H\dot{\delta}\) acts like expansion damping. Gravity drives growth through the density term. In a matter-dominated universe, growing-mode perturbations scale approximately as:

\[
\delta \propto a
\]

Interpretation: In a matter-dominated universe, linear density perturbations grow roughly with the scale factor.

In a dark-energy-dominated era, growth slows because accelerated expansion reduces the ability of matter to cluster gravitationally.

The linear growth factor \(D(a)\) is defined so that:

\[
\delta(\mathbf{x},a)
=
D(a)\delta(\mathbf{x},a_{\mathrm{initial}})
\]

Interpretation: The growth factor tracks how linear perturbation amplitude changes with scale factor.

up to normalization. Observational measurements of growth test gravity, dark energy, neutrino mass, and the consistency of ΛCDM. Redshift-space distortions and weak lensing are especially important because they probe how structure grows, not only how the universe expands.

The distinction between expansion and growth is crucial. Two cosmological models may produce similar distance-redshift relations while predicting different growth histories. Combining geometry probes with growth probes is therefore a powerful way to test dark energy, modified gravity, neutrino mass, and dark matter physics.

Back to top ↑

Matter Power Spectrum

The matter power spectrum describes the statistical distribution of density fluctuations across spatial scales. If \(\delta(\mathbf{k})\) is the Fourier transform of the density contrast, the power spectrum \(P(k)\) is defined by:

\[
\langle \delta(\mathbf{k})\delta^*(\mathbf{k}’)\rangle
=
(2\pi)^3
\delta_D(\mathbf{k}-\mathbf{k}’)
P(k)
\]

Interpretation: The power spectrum measures fluctuation variance as a function of spatial wavenumber.

The dimensionless power spectrum is often written as:

\[
\Delta^2(k)
=
\frac{k^3P(k)}{2\pi^2}
\]

Interpretation: The dimensionless spectrum expresses contribution to variance per logarithmic interval in \(k\).

The shape of \(P(k)\) carries information about primordial perturbations, matter-radiation equality, baryon acoustic features, dark matter behavior, neutrino mass, and nonlinear evolution. On very large scales, the primordial spectrum dominates. On smaller scales, transfer functions and nonlinear effects reshape the spectrum.

Galaxy surveys do not measure the matter power spectrum directly. Galaxies are biased tracers of matter, so one often writes:

\[
P_g(k)
=
b^2P_m(k)
\]

Interpretation: In simple linear bias, galaxy clustering power is scaled from matter clustering power by \(b^2\).

in a simple linear-bias approximation, where \(b\) is galaxy bias. Real analyses require much more sophisticated treatment of bias, redshift-space distortions, nonlinearities, selection effects, survey geometry, and covariance.

The power spectrum is a compression of a field into a statistic. It is powerful because many cosmological models predict statistical structure more robustly than individual galaxies. But it is not the only statistic. Correlation functions, bispectra, peak counts, void statistics, lensing maps, marked correlations, and machine-learning summaries can all contain additional information, especially in the nonlinear regime.

Back to top ↑

Halos, Galaxies, and Bias

Dark matter halos are gravitationally bound structures formed by nonlinear collapse. Galaxies form within halos through baryonic processes: gas cooling, star formation, feedback, black-hole growth, chemical enrichment, mergers, and environmental effects. Because galaxy formation is complex, galaxies do not perfectly trace mass.

Galaxy bias describes the relationship between galaxy density and matter density. In the simplest linear form:

\[
\delta_g=b\delta_m
\]

Interpretation: Linear galaxy bias relates galaxy overdensity to matter overdensity.

where \(\delta_g\) is galaxy density contrast, \(\delta_m\) is matter density contrast, and \(b\) is bias. But bias can be scale-dependent, redshift-dependent, nonlinear, stochastic, and tracer-specific.

Halo models describe large-scale structure by decomposing matter into halos. The two-point correlation function can be separated into a one-halo term and a two-halo term. The one-halo term describes correlations within the same halo; the two-halo term describes correlations between distinct halos.

This halo-based view bridges cosmology and galaxy formation. It explains why large-scale galaxy clustering can be used for cosmological inference while also requiring astrophysical modeling.

Bias is not merely a nuisance. It is a physical relationship between matter, halo mass, galaxy type, environment, redshift, and selection. Cosmological inference becomes stronger when bias is modeled as part of the astrophysical system rather than treated as an arbitrary correction.

Back to top ↑

Weak Lensing and Cosmic Shear

Weak gravitational lensing measures small distortions in the apparent shapes of background galaxies caused by foreground mass. Because lensing responds to total gravitational mass, including dark matter, it is one of the most direct probes of the matter distribution.

The lensing convergence \(\kappa\) is related to the projected matter density along the line of sight. Cosmic shear measures coherent distortions statistically over large galaxy samples. Weak lensing is sensitive to both geometry and structure growth, making it powerful for constraining dark energy, matter density, and fluctuation amplitude.

A common parameter combination in weak-lensing analyses is:

\[
S_8
=
\sigma_8
\left(
\frac{\Omega_m}{0.3}
\right)^\alpha
\]

Interpretation: \(S_8\) combines matter density and clustering amplitude in a way often constrained by weak-lensing surveys.

with \(\alpha\) often near \(0.5\), depending on analysis convention. Here \(\sigma_8\) measures the amplitude of matter fluctuations on \(8h^{-1}\) Mpc scales. Differences between weak-lensing and CMB-inferred values of clustering amplitude are part of ongoing cosmological tension discussions.

Weak lensing is also one of the most demanding observational probes. It requires accurate galaxy shape measurement, point-spread-function modeling, photometric redshift calibration, intrinsic alignment modeling, baryonic feedback treatment, survey mask handling, and covariance estimation. Its power comes from sensitivity to total mass; its difficulty comes from extracting tiny coherent distortions from noisy galaxy images.

Back to top ↑

Dark Energy and Cosmic Acceleration

Cosmic acceleration was discovered through observations of distant Type Ia supernovae, which appeared dimmer than expected in a decelerating universe. In ΛCDM, acceleration is explained by a cosmological constant with:

\[
w=-1
\]

Interpretation: A cosmological constant has equation-of-state parameter \(w=-1\).

More general dark-energy models allow the equation-of-state parameter \(w\) to differ from \(-1\) or evolve with time. A common parameterization is:

\[
w(a)=w_0+w_a(1-a)
\]

Interpretation: The \(w_0\)-\(w_a\) parameterization allows dark-energy behavior to vary with scale factor.

where \(w_0\) is the present value and \(w_a\) describes evolution with scale factor. This parameterization is phenomenological, not a fundamental theory, but it is useful for comparing data.

Recent DESI DR2 BAO analyses have made evolving dark energy an especially active area of discussion. Some combinations of DESI BAO, CMB, and supernova datasets show hints that dark energy may deviate from a constant cosmological constant. These hints are scientifically important, but they are not yet a settled discovery. Their interpretation depends on dataset combinations, supernova calibration, CMB constraints, model assumptions, systematics, and statistical treatment. A careful cosmology article should therefore describe evolving dark energy as an active observational possibility, not as an established replacement for ΛCDM.

Dark energy is also a conceptual problem. A cosmological constant is simple as a parameter, but difficult as fundamental physics. Dynamical dark energy, modified gravity, vacuum energy, scalar fields, and effective descriptions all remain under discussion. Cosmology cannot resolve the problem by naming \(\Lambda\); it must connect observations to physical interpretation.

Back to top ↑

Hubble Tension and Cosmological Tensions

The Hubble tension refers to the discrepancy between early-universe inferences of \(H_0\), especially those based on CMB data interpreted through ΛCDM, and some late-universe distance-ladder measurements. The tension matters because it may indicate unrecognized systematic error, incomplete modeling, or physics beyond the minimal ΛCDM framework.

Other tensions involve structure growth, weak-lensing clustering amplitude, supernova calibration, BAO combinations, neutrino mass inference, and dark-energy parameterizations. Cosmological tensions should be treated carefully. They are not automatically discoveries of new physics, but neither should they be dismissed. They are signals that consistency across probes must be tested rigorously.

The central question is whether one model can consistently explain CMB anisotropies, BAO, supernova distances, weak lensing, galaxy clustering, local distance measurements, cluster counts, and gravitational-wave standard sirens. The future of cosmology depends on cross-validation across independent instruments, methods, redshift ranges, and systematics.

Tensions are especially important because cosmology is a networked inference problem. A parameter such as \(H_0\), \(S_8\), \(\Omega_m\), or \(w\) is not measured in isolation. It is inferred through assumptions about calibration, cosmic geometry, perturbation growth, astrophysical modeling, and priors. Disagreement may reveal new physics, but it may also reveal where the inference chain is more fragile than expected.

Back to top ↑

Parameter Inference and Cosmological Likelihoods

Cosmological parameters are inferred by comparing models with data. A model predicts observables such as CMB power spectra, distance-redshift relations, BAO scales, matter power spectra, lensing correlations, cluster counts, or supernova magnitudes. Data provide measured values with covariance. The likelihood quantifies how well the model accounts for the observations.

A schematic Gaussian likelihood is:

\[
-2\ln\mathcal{L}
=
(\mathbf{d}-\mathbf{m}(\boldsymbol{\theta}))^T
C^{-1}
(\mathbf{d}-\mathbf{m}(\boldsymbol{\theta}))
+
\mathrm{constant}
\]

Interpretation: A Gaussian likelihood compares data \(\mathbf{d}\) with model prediction \(\mathbf{m}\) using covariance matrix \(C\).

Here \(\boldsymbol{\theta}\) represents cosmological and nuisance parameters, \(C\) is the covariance matrix, and \(\mathbf{d}-\mathbf{m}\) is the residual between measurement and model. Real likelihoods can include non-Gaussian terms, calibration parameters, foreground models, selection functions, photo-\(z\) uncertainties, intrinsic alignments, baryonic feedback, emulator errors, and survey-specific systematics.

Bayesian inference combines likelihood and prior information:

\[
P(\boldsymbol{\theta}|\mathbf{d})
\propto
\mathcal{L}(\mathbf{d}|\boldsymbol{\theta})
P(\boldsymbol{\theta})
\]

Interpretation: Posterior parameter constraints combine likelihood with prior assumptions.

This is why cosmological constraints must be read with attention to model space. A tight parameter contour under ΛCDM is not the same as a direct measurement independent of theory. It is a constraint within a specified model, likelihood, dataset combination, and prior structure.

Good cosmological inference therefore requires more than best-fit parameters. It requires residual checks, posterior predictive tests, blinded analyses where appropriate, alternative model comparisons, independent pipelines, covariance validation, data-release transparency, and careful treatment of nuisance parameters. The field is strongest when it treats inference as a reproducible scientific object.

Back to top ↑

Cosmological Simulations

Cosmological simulations are essential because structure formation becomes nonlinear. N-body simulations model dark matter particles interacting gravitationally in an expanding universe. Hydrodynamic simulations add gas dynamics, cooling, star formation, feedback, black holes, magnetic fields, and radiation processes.

The equation of motion for particles in an expanding background can be written schematically in comoving coordinates as:

\[
\ddot{\mathbf{x}}
+
2H\dot{\mathbf{x}}
=
-\frac{1}{a^2}\nabla\Phi
\]

Interpretation: Particle motion in comoving coordinates includes expansion damping and gravitational acceleration.

where \(\Phi\) is the gravitational potential satisfying a cosmological Poisson equation:

\[
\nabla^2\Phi
=
4\pi G a^2\bar{\rho}\delta
\]

Interpretation: The cosmological Poisson equation relates gravitational potential to density contrast.

Simulations connect initial conditions from early-universe perturbations to late-time galaxy distributions. They produce mock catalogs, covariance matrices, halo mass functions, lensing maps, clustering statistics, merger trees, and survey forecasts. They also help distinguish cosmological effects from astrophysical processes and observational selection effects.

However, simulations have limitations. Finite volume affects large-scale modes. Resolution limits small-scale structure. Baryonic feedback is difficult to model. Subgrid physics introduces assumptions. Cosmological inference must account for numerical convergence, parameter calibration, emulator uncertainty, and comparison with observations.

Simulations are therefore not merely visualizations of the cosmic web. They are part of the measurement apparatus of modern cosmology. A survey result may depend on simulated covariance matrices, mock catalogs, selection effects, nonlinear corrections, halo occupation models, or hydrodynamic feedback corrections. Simulation provenance is part of scientific credibility.

Back to top ↑

The Observational Frontier

The observational frontier of cosmology is moving toward larger, deeper, more precise, and more cross-validated surveys. CMB experiments measure temperature, polarization, lensing, and possible primordial gravitational-wave signatures. Galaxy surveys map clustering and BAO across enormous volumes. Weak-lensing surveys measure cosmic shear. Supernova programs refine the distance-redshift relation. Gravitational-wave standard sirens offer an independent route to distances. 21-cm cosmology may eventually map neutral hydrogen across vast cosmic epochs.

DESI, Euclid, the Vera C. Rubin Observatory, the Nancy Grace Roman Space Telescope, CMB-S4, the Simons Observatory, SKA-related surveys, and future gravitational-wave observatories will continue testing ΛCDM, dark energy, modified gravity, neutrino mass, inflation, and the growth of structure.

The field is entering an era where statistical precision can outpace systematic understanding. This makes reproducibility, open data products, survey masks, covariance matrices, mock catalogs, calibration transparency, code availability, and cross-survey comparison central to cosmological credibility.

The next generation of cosmology will be shaped by consistency. It will not be enough for one probe to prefer one model. The question will be whether independent probes, independent pipelines, independent calibration methods, and independent physical observables converge on the same cosmic history. The frontier is therefore not only larger datasets, but stronger epistemic architecture.

Back to top ↑

Measurement, Units, and SI Interpretation

Cosmology uses a mixture of SI units, astronomical units, natural units, and dimensionless parameters. Distances are often measured in megaparsecs:

\[
1\,\mathrm{Mpc}
\approx
3.0857\times10^{22}\,\mathrm{m}
\]

Interpretation: A megaparsec is a standard astronomical distance unit used in cosmology.

The Hubble constant is commonly expressed as:

\[
H_0
=
100h\,\mathrm{km\,s^{-1}\,Mpc^{-1}}
\]

Interpretation: The dimensionless parameter \(h\) rescales the Hubble constant relative to 100 km s\(^{-1}\) Mpc\(^{-1}\).

where \(h\) is dimensionless. A value \(H_0=70\,\mathrm{km\,s^{-1}\,Mpc^{-1}}\) corresponds to \(h=0.70\).

Density parameters are dimensionless ratios relative to the critical density:

\[
\Omega_i
=
\frac{\rho_i}{\rho_c}
\]

Interpretation: Density parameters express each component as a fraction of critical density.

The critical density is:

\[
\rho_c
=
\frac{3H_0^2}{8\pi G}
\]

Interpretation: Critical density is the density scale associated with spatial flatness in Friedmann cosmology.

Redshift \(z\), scale factor \(a\), density contrast \(\delta\), and power-spectrum shape parameters are dimensionless. Comoving wavenumber \(k\) is often measured in \(\mathrm{Mpc}^{-1}\) or \(h\,\mathrm{Mpc}^{-1}\). Power spectra then have corresponding volume units, such as \(\mathrm{Mpc}^3\) or \((h^{-1}\mathrm{Mpc})^3\), depending on convention.

Computational cosmology must document units carefully. Confusing physical and comoving distance, \(h^{-1}\) scaling, SI units, natural units, or angular versus comoving quantities can produce serious errors.

Unit conventions also affect communication. A quantity reported in \(h^{-1}\mathrm{Mpc}\) is not the same as one reported in \(\mathrm{Mpc}\). A simulation box size, halo mass, power spectrum, or distance table may silently encode a value of \(h\). Reproducible workflows should record constants, unit systems, \(h\)-scaling, and whether coordinates are physical or comoving.

Back to top ↑

Mathematical Lens

A mathematics-first view of cosmology begins with the FLRW metric:

\[
ds^2
=
-c^2dt^2
+
a(t)^2
\left[
\frac{dr^2}{1-kr^2}
+
r^2d\Omega^2
\right]
\]

Interpretation: The FLRW metric is the geometric foundation for homogeneous and isotropic cosmology.

The Hubble parameter is:

\[
H(t)=\frac{\dot{a}}{a}
\]

Interpretation: The Hubble parameter is the fractional rate of change of the scale factor.

The first Friedmann equation is:

\[
H^2
=
\frac{8\pi G}{3}\rho

\frac{kc^2}{a^2}
+
\frac{\Lambda c^2}{3}
\]

Interpretation: The Friedmann equation relates cosmic expansion to density, curvature, and cosmological constant.

The critical density is:

\[
\rho_c
=
\frac{3H^2}{8\pi G}
\]

Interpretation: Critical density sets the reference density for cosmological density parameters.

The density parameters satisfy, today:

\[
\Omega_r+\Omega_m+\Omega_k+\Omega_\Lambda=1
\]

Interpretation: In the standard density-parameter convention, all components sum to unity today.

where:

\[
\Omega_k=-\frac{kc^2}{a_0^2H_0^2}
\]

Interpretation: The curvature density parameter expresses spatial curvature in dimensionless form.

The expansion function is:

\[
E(z)
=
\frac{H(z)}{H_0}
=
\sqrt{
\Omega_r(1+z)^4
+
\Omega_m(1+z)^3
+
\Omega_k(1+z)^2
+
\Omega_\Lambda
}
\]

Interpretation: Radiation, matter, curvature, and dark energy scale differently with redshift.

For dark energy with equation of state \(w\), the dark-energy density evolves as:

\[
\rho_{\mathrm{de}}(a)
\propto
a^{-3(1+w)}
\]

Interpretation: The equation of state controls how dark-energy density changes with expansion.

The comoving radial distance in a flat universe is:

\[
\chi(z)
=
c
\int_0^z
\frac{dz’}{H(z’)}
\]

Interpretation: Comoving distance integrates inverse expansion rate along the line of sight.

The luminosity distance is:

\[
D_L(z)
=
(1+z)\chi(z)
\]

Interpretation: Luminosity distance relates intrinsic luminosity to observed flux in an expanding universe.

The angular diameter distance is:

\[
D_A(z)
=
\frac{\chi(z)}{1+z}
\]

Interpretation: Angular diameter distance relates physical size to observed angular size.

The density contrast is:

\[
\delta(\mathbf{x},t)
=
\frac{\rho(\mathbf{x},t)-\bar{\rho}(t)}{\bar{\rho}(t)}
\]

Interpretation: Density contrast measures deviations from the mean cosmic density.

and the linear growth equation is:

\[
\ddot{\delta}
+
2H\dot{\delta}

4\pi G\bar{\rho}_m\delta
=
0
\]

Interpretation: Linear growth depends on gravitational clustering and expansion damping.

The power spectrum is defined by:

\[
\langle \delta(\mathbf{k})\delta^*(\mathbf{k}’)\rangle
=
(2\pi)^3\delta_D(\mathbf{k}-\mathbf{k}’)P(k)
\]

Interpretation: The matter power spectrum describes statistical clustering strength by scale.

This mathematical lens shows how cosmology connects geometry, expansion, density, perturbation growth, and statistical structure. The equations are not isolated formulas; they form a chain from spacetime metric to expansion history, from expansion history to distance measures, from density perturbations to clustering statistics, and from clustering statistics to cosmological inference.

Back to top ↑

Variables, Units, and Physical Interpretation

Cosmology depends on variables that connect spacetime geometry, expansion history, matter content, perturbation growth, and observation. The table below summarizes several central quantities.

Key Symbols for Cosmology and Large-Scale Structure
Symbol or Term Meaning Typical Unit or Dimension Physical Interpretation
\(a(t)\) Scale factor dimensionless Relative expansion of the universe
\(z\) Redshift dimensionless Observed wavelength stretch; proxy for cosmic time
\(H(z)\) Hubble parameter km s\(^{-1}\) Mpc\(^{-1}\) or s\(^{-1}\) Expansion rate at redshift \(z\)
\(H_0\) Hubble constant today km s\(^{-1}\) Mpc\(^{-1}\) Present-day expansion rate
\(\Omega_m\) Matter density parameter dimensionless Present matter density relative to critical density
\(\Omega_\Lambda\) Dark-energy density parameter dimensionless Cosmological-constant density relative to critical density
\(\Omega_b\) Baryon density parameter dimensionless Ordinary matter contribution
\(\Omega_k\) Curvature density parameter dimensionless Spatial curvature contribution to expansion
\(w\) Equation-of-state parameter dimensionless Relates pressure to energy density
\(\delta\) Density contrast dimensionless Fractional overdensity or underdensity
\(P(k)\) Matter power spectrum volume units Variance of density fluctuations by spatial scale
\(\sigma_8\) Fluctuation amplitude dimensionless RMS matter fluctuation on \(8h^{-1}\) Mpc scales
\(S_8\) Weak-lensing clustering combination dimensionless Combination of \(\sigma_8\) and \(\Omega_m\) often constrained by lensing
\(D_A\) Angular diameter distance Mpc Relates physical size to observed angular size
\(D_L\) Luminosity distance Mpc Relates intrinsic luminosity to observed flux
\(r_d\) Sound horizon scale Mpc BAO standard ruler inherited from early-universe acoustic physics

Note: Cosmological variables often combine observational, geometric, and statistical meanings. Unit conventions should distinguish physical and comoving distance, \(h^{-1}\) scaling, redshift, and dimensionless density parameters.

Back to top ↑

Worked Example: Expansion History in Flat ΛCDM

Consider a flat ΛCDM universe with:

\[
\Omega_m=0.315
\]

Interpretation: Matter contributes 31.5 percent of the critical density in this example.

\[
\Omega_\Lambda=0.685
\]

Interpretation: Dark energy contributes 68.5 percent of the critical density in this example.

Ignoring radiation for a low-redshift example, the dimensionless expansion function is:

\[
E(z)
=
\sqrt{
\Omega_m(1+z)^3+\Omega_\Lambda
}
\]

Interpretation: The expansion function combines matter and dark-energy contributions at redshift \(z\).

At \(z=1\):

\[
E(1)
=
\sqrt{
0.315(2)^3+0.685
}
\]

Interpretation: Redshift one corresponds to \(1+z=2\), so matter density scales by \(2^3\).

\[
=
\sqrt{
2.52+0.685
}
=
\sqrt{3.205}
\approx 1.790
\]

Interpretation: The expansion rate at redshift one is about 1.79 times today’s value in this simplified example.

If:

\[
H_0=67.4\,\mathrm{km\,s^{-1}\,Mpc^{-1}}
\]

Interpretation: This example uses a representative Hubble constant value.

then:

\[
H(1)
=
H_0E(1)
\approx
67.4\times 1.790
\approx
120.6\,\mathrm{km\,s^{-1}\,Mpc^{-1}}
\]

Interpretation: The fractional expansion rate at \(z=1\) was higher than today in this ΛCDM example.

This does not mean that objects at redshift one move through space with a single simple velocity. It means the fractional expansion rate at that epoch was higher than today. Distance, time, and expansion must be interpreted through the full FLRW geometry.

The example also shows how strongly matter density evolves with redshift. At \(z=1\), matter contributes by the factor \((1+z)^3=8\), while the cosmological constant remains constant. This is why matter dominated earlier cosmic expansion, while dark energy dominates late-time expansion.

Back to top ↑

Computational Modeling

Computational modeling makes cosmology operational. A background-expansion workflow can compute \(E(z)\), \(H(z)\), comoving distance, angular diameter distance, and luminosity distance. A growth workflow can approximate linear structure growth. A power-spectrum workflow can compare toy primordial spectra, transfer suppression, and BAO-like wiggles. A survey workflow can track redshift ranges, tracers, and observables. A simulation workflow can record box sizes, particle counts, mass resolution, and cosmological parameters. A metadata system can preserve data provenance, assumptions, constants, cosmological parameters, numerical methods, random seeds, and source references.

The selected examples below focus on expansion history and linear structure growth because they are foundational, readable, and directly reusable. The GitHub repository extends the same logic into richer computational examples: R FLRW expansion tables, Python growth and toy power spectra, BAO scale calculations, distance measures, survey metadata, simulation summaries, Julia cosmology calculations, C++ distance sweeps, Fortran expansion tables, SQL cosmology provenance, Rust command-line utilities, C examples, documentation, and reproducible sample data.

These workflows are intentionally transparent. Their purpose is not to replace professional cosmology libraries or Boltzmann solvers. Their purpose is to show the computational structure of the problem: choose parameters, compute expansion, integrate distances, approximate growth, model scale-dependent power, document assumptions, and preserve provenance. Production cosmology uses more sophisticated tools, but the conceptual pipeline is already visible in simplified form.

Back to top ↑

R Workflow: FLRW Expansion and Distance-Redshift Table

R is useful for transparent cosmological tables, parameter sweeps, and reproducible statistical reporting. The following workflow computes \(E(z)\), \(H(z)\), comoving distance, angular diameter distance, and luminosity distance for a flat ΛCDM model.

# FLRW Expansion and Distance-Redshift Table
#
# This workflow computes basic background-expansion quantities
# for a flat Lambda-CDM cosmology:
#
#   E(z) = sqrt(Omega_m * (1 + z)^3 + Omega_Lambda)
#
# It uses a simple numerical trapezoid rule for comoving distance.
# This is a transparent teaching workflow, not a replacement for
# professional cosmology libraries.

library(tibble)
library(dplyr)

speed_of_light_km_s <- 299792.458

hubble_constant <- 67.4
omega_matter <- 0.315
omega_lambda <- 0.685

e_z <- function(z) {
  sqrt(omega_matter * (1 + z)^3 + omega_lambda)
}

h_z <- function(z) {
  hubble_constant * e_z(z)
}

comoving_distance_mpc <- function(z_max, n_grid = 5000) {
  z_grid <- seq(0, z_max, length.out = n_grid)
  integrand <- 1 / e_z(z_grid)

  dz <- z_grid[2] - z_grid[1]

  integral <- dz * (
    0.5 * first(integrand) +
      sum(integrand[2:(length(integrand) - 1)]) +
      0.5 * last(integrand)
  )

  (speed_of_light_km_s / hubble_constant) * integral
}

redshift_table <- tibble(
  redshift = c(0.0, 0.1, 0.5, 1.0, 2.0, 3.0, 6.0)
) %>%
  rowwise() %>%
  mutate(
    scale_factor = 1 / (1 + redshift),
    expansion_e_z = e_z(redshift),
    hubble_parameter_km_s_mpc = h_z(redshift),
    comoving_distance_mpc =
      if_else(redshift == 0, 0, comoving_distance_mpc(redshift)),
    angular_diameter_distance_mpc =
      comoving_distance_mpc / (1 + redshift),
    luminosity_distance_mpc =
      comoving_distance_mpc * (1 + redshift)
  ) %>%
  ungroup()

print(redshift_table)

This workflow demonstrates how cosmological distance measures are derived from the expansion history. The comoving distance integrates \(1/H(z)\), the angular diameter distance divides by \(1+z\), and the luminosity distance multiplies by \(1+z\). These relationships connect spacetime expansion to observables such as galaxy angular size, supernova flux, and BAO scale measurements.

The workflow also demonstrates a reproducibility habit: constants and parameters are named explicitly. A more complete workflow would record parameter provenance, unit conventions, integration tolerances, and comparison against a validated cosmology package. Even simple calculations should be auditable.

Back to top ↑

Python Workflow: Linear Growth and Toy Matter Power Spectrum

Python is useful for numerical cosmology, integration, simulation examples, and survey pipelines. The following workflow computes a simple approximation to the linear growth factor and builds a toy matter power spectrum with transfer suppression and BAO-like wiggles.

"""
Linear Growth and Toy Matter Power Spectrum

This workflow demonstrates two core cosmology calculations:

1. A simple approximation to the linear growth factor in flat Lambda-CDM.
2. A toy matter power spectrum with primordial tilt, transfer suppression,
   and BAO-like oscillatory structure.

This is a teaching example. Production cosmology should use validated
Boltzmann solvers, survey likelihoods, covariance matrices, and professional
cosmology libraries.
"""

from __future__ import annotations

import numpy as np
import pandas as pd


HUBBLE_CONSTANT = 67.4
OMEGA_MATTER = 0.315
OMEGA_LAMBDA = 0.685
SCALAR_SPECTRAL_INDEX = 0.965
SIGMA8_LIKE_NORMALIZATION = 0.811


def e_z(redshift: np.ndarray | float) -> np.ndarray | float:
    """
    Dimensionless expansion function E(z) for flat Lambda-CDM.
    """
    return np.sqrt(OMEGA_MATTER * (1.0 + redshift) ** 3 + OMEGA_LAMBDA)


def omega_m_z(redshift: np.ndarray | float) -> np.ndarray | float:
    """
    Matter density fraction as a function of redshift.
    """
    return OMEGA_MATTER * (1.0 + redshift) ** 3 / e_z(redshift) ** 2


def approximate_growth_factor(redshift: np.ndarray | float) -> np.ndarray:
    """
    Approximate growth factor normalized to D(z=0)=1.

    Uses a common growth-index approximation:
        f = d ln D / d ln a approximately Omega_m(z)^gamma
    with gamma approximately 0.55 for general relativity with
    Lambda-CDM-like dark energy.

    This teaching implementation integrates outward from z=0.
    """
    z_array = np.atleast_1d(redshift)
    z_max = float(np.max(z_array))

    if z_max == 0:
        return np.ones_like(z_array, dtype=float)

    z_grid = np.linspace(0.0, z_max, 2500)
    gamma = 0.55

    f_grid = omega_m_z(z_grid) ** gamma
    dln1pz = np.gradient(np.log(1.0 + z_grid))

    ln_growth = -np.cumsum(f_grid * dln1pz)
    growth_grid = np.exp(ln_growth)
    growth_grid /= growth_grid[0]

    return np.interp(z_array, z_grid, growth_grid)


def toy_transfer_function(wavenumber_h_mpc: np.ndarray) -> np.ndarray:
    """
    Smooth toy transfer suppression.

    This is not a physical Boltzmann transfer function. It only illustrates
    how small-scale power can be suppressed relative to primordial scaling.
    """
    equality_scale = 0.02
    return 1.0 / (1.0 + (wavenumber_h_mpc / equality_scale) ** 2)


def toy_bao_wiggle(wavenumber_h_mpc: np.ndarray) -> np.ndarray:
    """
    Add a damped BAO-like oscillatory feature.
    """
    sound_horizon_mpc_h = 105.0
    damping_scale = 0.18

    return 1.0 + 0.06 * np.sin(
        wavenumber_h_mpc * sound_horizon_mpc_h
    ) * np.exp(
        -(wavenumber_h_mpc / damping_scale) ** 2
    )


def toy_matter_power_spectrum(
    wavenumber_h_mpc: np.ndarray,
    redshift: float,
) -> np.ndarray:
    """
    Toy matter power spectrum:
        P(k,z) = A k^n T(k)^2 W_BAO(k) D(z)^2
    """
    growth = approximate_growth_factor(redshift)[0]
    amplitude = SIGMA8_LIKE_NORMALIZATION

    return (
        amplitude
        * wavenumber_h_mpc ** SCALAR_SPECTRAL_INDEX
        * toy_transfer_function(wavenumber_h_mpc) ** 2
        * toy_bao_wiggle(wavenumber_h_mpc)
        * growth**2
    )


def main() -> None:
    """
    Build growth and toy power-spectrum tables.
    """
    redshifts = np.array([0.0, 0.5, 1.0, 2.0, 3.0, 6.0])

    growth_table = pd.DataFrame(
        {
            "redshift": redshifts,
            "scale_factor": 1.0 / (1.0 + redshifts),
            "E_z": e_z(redshifts),
            "omega_m_z": omega_m_z(redshifts),
            "growth_factor_approx": approximate_growth_factor(redshifts),
        }
    )

    k_values = np.logspace(-3, 0, 160)

    spectrum_rows = []
    for redshift in [0.0, 1.0, 3.0]:
        power = toy_matter_power_spectrum(k_values, redshift)
        for k, p in zip(k_values, power):
            spectrum_rows.append(
                {
                    "redshift": redshift,
                    "wavenumber_h_mpc": k,
                    "toy_power": p,
                }
            )

    spectrum_table = pd.DataFrame(spectrum_rows)

    print("Approximate linear growth table:")
    print(growth_table.round(6).to_string(index=False))

    print("\nToy matter power spectrum sample:")
    print(
        spectrum_table.groupby("redshift")
        .head(8)
        .round(8)
        .to_string(index=False)
    )


if __name__ == "__main__":
    main()

This workflow demonstrates the computational structure of large-scale structure analysis: define a cosmology, compute expansion, approximate growth, define scale-dependent power, and compare redshift evolution. A real analysis would replace the toy transfer function with a Boltzmann solver, model nonlinear evolution, include galaxy bias and redshift-space distortions, estimate covariance, and fit survey data with validated likelihoods.

The toy spectrum is intentionally not a production physical model. Its value is pedagogical: it separates primordial tilt, transfer suppression, BAO-like features, and growth evolution into visible computational components. That separation helps readers understand what full cosmology codes and survey pipelines are doing at a higher level of rigor.

GitHub Repository

The article body includes only selected computational examples so the conceptual and mathematical argument remains readable. The full repository contains the expanded computational resources: R FLRW expansion tables, Python growth and toy power spectra, BAO scale calculations, distance measures, survey metadata, simulation summaries, Julia cosmology calculations, C++ distance sweeps, Fortran expansion tables, SQL cosmology provenance, Rust command-line utilities, C examples, documentation, and reproducible sample data.

Back to top ↑

From Background Expansion to Cosmic Structure

Cosmology connects the smooth expansion of spacetime to the structured universe observed today. The FLRW metric describes the background. Friedmann equations govern expansion. Inflation explains why primordial perturbations may have been nearly scale invariant. The CMB records early-universe acoustic physics. Dark matter enables structure growth. Baryons form galaxies. Dark energy shapes late-time expansion. Large-scale surveys test whether this whole picture fits together.

Within the Physics knowledge series, this article belongs near General Relativity: Geometry, Gravity, and Spacetime Curvature, Quantum Field Theory I: Fields, Particles, and Second Quantization, Path Integrals and the Functional Formulation of Physics, Statistical Physics and the Emergence of Macroscopic Order, Many-Body Physics and Emergent Collective Behavior, and Computational Physics and Scientific Simulation. It provides the large-scale synthesis of spacetime, matter, radiation, perturbation growth, and observational inference.

The next conceptual steps are natural. Inflationary Cosmology and the Early Universe develops the primordial side. Dark Matter: Evidence, Models, and Detection develops the missing-mass problem. Dark Energy, Cosmic Acceleration, and the Fate of the Universe develops late-time acceleration. Computational Cosmology: Simulations, Surveys, and Inference develops the numerical and data-science frontier.

The deeper lesson is methodological. Cosmology is not only a story about the universe’s origin and fate. It is a discipline of connecting spacetime geometry, particle content, thermal history, statistical perturbations, observational maps, simulations, and inference. Its authority comes from the way these independent lines of evidence constrain one another.

Back to top ↑

Further Reading

Back to top ↑

References

Back to top ↑

Scroll to Top