24,000 stars, each one pulled by every other star. This is not a picture of
a merger — it is one, computed. Every frame below is a real state of a
real simulated system, output of a Barnes–Hut N−body integrator I wrote in
C (~/src/ngalaxy.c), rendered top-down as a density of starlight.
Fixed timestep dt=0.015

One step size for every star, everywhere. Fast through pericentre the integrator can’t keep up: energy leaks −61% at the closest pass. The tails and bridge are right; the final object is over-bound.
Adaptive timestep Courant

dt ≤ η·√(ε/|a|) for the most-accelerated star, capped at 0.015. Step shrinks to ~0.008 through pericentre: leak drops to −13%, and the nuclei hold a faithful closest approach (r≈1.8) instead of a spurious plunge.
Frames are every 25 integration steps. The galaxies start 7 units apart on a near-parabolic fly-by; pericentre (the “eye of the storm”) is the dense S-shaped bridge of stars linking the two cores. The adaptive run advances less simulation time in 2000 steps (dt is smaller), so its clock tops out near t≈17.
Each galaxy starts as a near-equilibrium disk: stars on circular orbits, with a dark-matter halo (a soft Plummer sphere) providing most of the mass so the disk doesn’t tear itself apart. The rotation curve of a single galaxy is computed by direct summation over the stars, so the disks are born already in balance — they don’t breathe.
As they fall together, the tidal field of each galaxy rips a tail of stars out of the other’s outer disk. Those long tidal tails are the signature of a merger; the Antennae galaxies (NGC 4038/4039) look exactly like this. The tails swing around, and at pericentre the two nuclei get surrounded by a swirling shell of debris — the “eye of the storm” in the hero image.
Because the stars are collisionless (they don’t hit each other, they pass through the smooth field), the merger can’t fully merge in a single pass — energy and angular momentum have to be redistributed. The violent relaxation shown here heats the disks and flings out shells, and the two cores take several passes to settle.
Physics has a price. I use leapfrog + a Barnes–Hut octree (θ=0.5) for speed. Leapfrog is symplectic, so for a smooth orbit energy is conserved to ~1 part in 20,000 over hundreds of steps. Barnes–Hut’s monopole approximation injects a small systematic energy bias, and at close pericentre (r<1) the fixed timestep can’t resolve the fastest motions. That is what the left animation shows: total energy leaks −61% at the deepest pass and settles to −37% — the post-coalescence object is a touch too bound.
The fix is on the right. Each step I take dt ≤ η·√(ε/|a|) over the most-accelerated star (a Courant condition), capped at the nominal 0.015, with a floor and a 1.5× growth limiter. The peak leak falls from 61% to 13% — five times smaller — and because the orbit no longer bleeds energy into the step, the nuclei reach a more faithful closest approach (r≈1.8) instead of the spurious plunge to 0.6 the fixed run produced. Thirteen percent is not “a few”; a tighter η and a higher-order integrator would chase it, and a tree-opening criterion tuned for energy conservation would shrink the monopole bias.