Get AI summaries of any video or article — Sign up free
How To Build The Universe in a Computer thumbnail

How To Build The Universe in a Computer

PBS Space Time·
5 min read

Based on PBS Space Time's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Galaxy mergers like the Milky Way–Andromeda collision can be treated as predictable because gravity and gas dynamics can be computed repeatedly over long timescales using numerical methods.

Briefing

Galaxy collisions can be predicted with striking confidence because gravity and fluid-like gas dynamics can be computed repeatedly over billions of years—turning a chaotic cosmic process into something simulatable. The core takeaway is that modern astrophysics doesn’t just “run models”; it builds practical approximations of an enormous many-body universe by breaking the problem into manageable steps and using algorithms that avoid brute-force calculations. That’s why events like the Milky Way and Andromeda’s eventual merger—complete with tidal streams, supernova-triggering gas compression, and the loss of spiral structure—can be treated as effectively inevitable outcomes of known physics.

The path to that capability runs through a key historical insight: exact solutions exist for only the simplest gravitational setups. Newton’s equations can be solved analytically for two bodies, but once three or more objects interact, the “3-body problem” has no tidy master equations. Erik Holmberg’s 1941 workaround used 37 light bulbs as gravity sources, iteratively measuring the combined “pull” at each bulb, updating velocities via Newton’s laws, and then letting the system evolve step by step—an early numerical calculation that foreshadowed today’s N-body simulations.

In an N-body simulation, the universe is represented by many particles whose motions follow gravity across discrete time steps. The method can be made arbitrarily accurate by shrinking the steps, and it already works well for smaller systems like the solar system. But galaxies are the bottleneck: a naive approach requires computing the force between every particle pair, scaling like N². For a million-particle star cluster, that means roughly a trillion interactions per time step—before even considering the need to model both fine detail (individual structures) and vast cosmic scales (large volumes).

Astrophysicists therefore rely on approximations that exploit how gravity weakens with distance. Tree codes reduce far-field interactions by grouping distant particles into hierarchical cubes, cutting the workload from N² down to about N log N. Particle-mesh methods convert particles into a density field on a grid, solve the gravitational potential efficiently using Fourier transforms, and use adaptive meshes to refine resolution where matter is dense. For gas dynamics, simulations shift from pure gravity to fluid equations: smoothed-particle hydrodynamics (SPH) replaces a rigid grid with moving tracer particles that carry the fluid’s properties. Modern runs often blend methods—SPH for large-scale gas flows paired with direct particle-particle N-body calculations for short-range accuracy.

These techniques enable increasingly ambitious virtual universes, from star formation in collapsing gas clouds to cosmological simulations spanning billions of light-years. The Millennium simulation modeled a 13-billion-light-year cube with over 300 billion particles, while AbacusSummit pushed to 70 trillion particles on supercomputers. Still, there’s a hard ceiling: typical simulations track only particle positions and velocities, not the full quantum information content of reality. A complete quantum universe would likely require a cosmically large quantum computer—so the practical limit is less about computing speed and more about what physics can be represented. The payoff remains real: simulations have become a primary way to test how structure forms, how galaxies evolve, and why the universe’s large-scale patterns emerge from microscopic rules.

Cornell Notes

Gravitational systems become unpredictable to solve exactly once more than two bodies interact, so astrophysics relies on numerical simulations. N-body methods step through time, updating particle positions under gravity, but brute-force force calculations scale too steeply for galaxies. Tree codes and particle-mesh techniques speed things up by approximating distant gravitational effects, while smoothed-particle hydrodynamics (SPH) models gas flows without a fixed grid. Modern galaxy and cosmological simulations often combine multiple methods and add extra physics like star evolution and radiation. Even so, simulations cannot contain the full quantum information of reality, so a truly complete quantum universe would require something like a universe-scale quantum computer.

Why does gravity become hard to compute beyond two bodies?

Newton’s equations can be solved analytically for a pair of massive objects, letting researchers compute positions at any future time. With three or more bodies, no simple closed-form “master equations” exist for the future evolution under gravity—this is the 3-body problem. That gap forces reliance on numerical calculations that approximate motion through repeated, smaller updates.

What makes N-body simulations accurate in principle but impractical at galaxy scale?

In an N-body simulation, gravity and motion are applied over a sequence of short time steps. If each step is small enough, the assumption that the global gravitational field is roughly constant during that step holds better, improving accuracy. The practical problem is computational scaling: the naive method computes the effect of every particle on every other particle, giving N² interactions per step. For a million-particle system, that’s about a trillion computations per time step, and galaxies also demand modeling across huge spatial scales.

How do tree codes reduce the cost of gravitational calculations?

Tree codes divide space into nested sub-cubes (an octree). They stop subdividing along a path when a cube contains no more than one particle. When calculating forces, nearby particles are treated individually, but distant regions are approximated by treating all particles inside a cube as a single grouped source. This changes the scaling from N² to roughly N log N, making large simulations feasible.

What is the particle-mesh approach, and why does it speed up gravity?

Particle-mesh methods map particles onto a grid by converting them into a density distribution, then compute the gravitational potential across that grid. The potential (and resulting forces) can be solved quickly using Fourier transform methods. Adaptive meshes add resolution in regions where structure is finer or density is higher, and modern mesh codes often combine grid-based forces with direct particle-particle interactions at short distances for accuracy.

How does SPH model gas compared with grid-based methods?

Smoothed-particle hydrodynamics (SPH) avoids a rigid grid. Instead, it tracks tracer particles that move with the fluid, effectively creating a constantly shifting sampling of the gas. SPH is used to simulate gas flows in galaxies and around quasars, including processes tied to star and planet formation and destruction. It can even treat stars as a fluid-like component in some galaxy-formation contexts.

Why can’t simulations fully reproduce a quantum universe?

Typical large-scale simulations track classical-like quantities such as particle positions and velocities. A full quantum description contains vastly more information than that. The transcript argues that no conceivable technology could fully simulate a quantum universe except perhaps a cosmically sized quantum computer—essentially the scale of the universe itself.

Review Questions

  1. What computational bottleneck arises from the N² scaling of naive gravitational force calculations, and why is it especially severe for galaxies?
  2. Compare tree codes, particle-mesh methods, and SPH: what physical interaction each targets and how each reduces computational cost.
  3. What does the transcript identify as the fundamental limitation of classical-style simulations when it comes to quantum information?

Key Points

  1. 1

    Galaxy mergers like the Milky Way–Andromeda collision can be treated as predictable because gravity and gas dynamics can be computed repeatedly over long timescales using numerical methods.

  2. 2

    Exact analytic solutions exist for two-body gravity, but the 3-body problem lacks simple closed-form equations, motivating step-by-step numerical calculation.

  3. 3

    N-body simulations update particle positions using gravity across discrete time steps; accuracy improves as time steps shrink, but cost grows rapidly with particle count.

  4. 4

    Tree codes accelerate gravity by grouping distant particles into hierarchical cubes, reducing work from N² to about N log N.

  5. 5

    Particle-mesh methods speed gravity by mapping particles to a grid and solving potentials with Fourier transforms, often with adaptive refinement and short-range particle-particle corrections.

  6. 6

    SPH models gas using moving tracer particles rather than a fixed grid, enabling realistic simulations of gas flows that drive star and planet formation.

  7. 7

    Even the largest simulations cannot include the full quantum information content of reality, implying a fundamental limit beyond computational power alone.

Highlights

Holmberg’s 1941 light-bulb experiment mirrored modern N-body logic: measure combined gravitational pull, update velocities with Newton’s laws, then advance the system in time steps.
Tree codes and particle-mesh methods exist because gravity weakens with distance squared—distant interactions can be approximated in bulk rather than computed pairwise.
SPH replaces a rigid grid with tracer particles that move with the fluid, making it well-suited for galaxy gas dynamics.
The transcript draws a hard line between classical simulation outputs (positions and velocities) and the far larger information content of a quantum description of the universe.

Topics

  • N-Body Simulations
  • Galaxy Collisions
  • Tree Codes
  • Particle-Mesh Methods
  • Smoothed-Particle Hydrodynamics (SPH)

Mentioned