How To Build The Universe in a Computer
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.
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?
What makes N-body simulations accurate in principle but impractical at galaxy scale?
How do tree codes reduce the cost of gravitational calculations?
What is the particle-mesh approach, and why does it speed up gravity?
How does SPH model gas compared with grid-based methods?
Why can’t simulations fully reproduce a quantum universe?
Review Questions
- What computational bottleneck arises from the N² scaling of naive gravitational force calculations, and why is it especially severe for galaxies?
- Compare tree codes, particle-mesh methods, and SPH: what physical interaction each targets and how each reduces computational cost.
- What does the transcript identify as the fundamental limitation of classical-style simulations when it comes to quantum information?
Key Points
- 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
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
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
Tree codes accelerate gravity by grouping distant particles into hierarchical cubes, reducing work from N² to about N log N.
- 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
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
Even the largest simulations cannot include the full quantum information content of reality, implying a fundamental limit beyond computational power alone.