Galaxy Collision
Cosmic Ballet
When galaxies collide, they create some of the most spectacular events in the universe. Gravitational tidal forces rip stars from their orbits, creating sweeping tidal tails and bridges that span hundreds of thousands of light-years.
This simulation uses N-body gravitational dynamics to model the merger of two disk galaxies, similar to the famous Antennae Galaxies or the predicted future collision of the Milky Way and Andromeda.
The Physics
N-Body Gravitation
Each star particle experiences gravitational attraction from all others. The acceleration includes a softening parameter ε that prevents:
- Numerical instabilities from close encounters
- Unrealistically high velocities
- Effectively models the extended mass of real star systems
Initial Conditions
Each galaxy is created with:
- Central bulge: Pressure-supported (random velocities)
- Disk component: Rotation-supported (circular orbits)
- Massive core particles: Simulate dark matter halo concentration
Galaxy Parameters:
- Stars per galaxy: 1500
- Disk radius: ~12 kpc
- Bulge fraction: 20%
- Initial separation: 70 kpc
- Impact parameter: 20 kpc
Simulation Stages
1. Approach
Two spiral galaxies approach each other on a hyperbolic orbit. Tidal forces begin to distort the outer regions.
2. First Passage
The galaxies pass through each other (stars rarely collide directly). Strong tidal forces pull out long streamers of stars.
3. Tidal Tail Formation
Material stripped from the outer disks forms spectacular tidal tails extending far from the merger site.
4. Second Passage & Merger
Gravitational friction slows the galaxies. They fall back together and eventually merge into a single, larger galaxy.
Animation
The animation above shows the gravitational N-body simulation in real-time.
Run It Yourself
claude -p "Load the galaxy_collision distribution, run MD simulation with 6000 steps \
at dt=0.018, render trajectory with per-particle colors (blue and red galaxies), \
and save to /tmp/galaxy_collision.gif" --allowedTools "mcp__molecular-mcp__*"
Real Galaxy Collisions
The Antennae Galaxies (NGC 4038/4039)
The Antennae are the closest example of a galaxy merger:
- Distance: 45 million light-years
- Status: Mid-merger
- Features: Spectacular tidal tails, intense star formation
- Future: Will become a single elliptical galaxy
Our simulation captures the essential physics of this interaction.
Milky Way - Andromeda Collision
In about 4.5 billion years, our Milky Way will collide with the Andromeda Galaxy (M31):
- Current separation: 2.5 million light-years
- Approach velocity: ~110 km/s
- Result: A new elliptical galaxy ("Milkomeda")
The Science
Why Stars Don't Collide
Even though galaxies "collide," individual stars almost never hit each other:
- Stars are tiny compared to the space between them
- If the Sun were a grain of sand, the nearest star would be 4 miles away
- Galaxies are mostly empty space
Tidal Forces
The gravitational gradient across a galaxy creates differential forces: ΔF ~ GM Δr / r³
This stretches the galaxy along the line connecting the two centers and compresses it perpendicular to this line.
Dynamical Friction
Galaxies lose orbital energy through:
- Gravitational wake: Each galaxy creates a wake of particles behind it
- Momentum transfer: Energy goes from bulk motion to random stellar motion
- Result: Galaxies spiral inward and eventually merge
Collision Scenarios
| Type | Impact Parameter | Features |
|---|---|---|
| Head-on | ~0 | Violent disruption, rapid merger |
| Moderate | 0.3 × R | Tidal tails, bridges, eventual merger |
| Glancing | > R | Long tidal streamers, may not merge |
Technical Notes
Integration Method
Velocity Verlet algorithm:
- Half-step velocities
- Full-step positions
- Compute new accelerations
- Complete velocity step
Computational Complexity
Direct N-body is O(N²) per timestep. For larger simulations, use:
- Barnes-Hut tree code: O(N log N)
- Fast Multipole Method: O(N)
- Particle-Mesh: O(N log N) with FFT
Related Demos
- Bragg Scattering - Quantum N-body analog
- Double-Slit - Wave interference
Further Reading
- Toomre & Toomre (1972): Classic paper on tidal tails
- Barnes & Hernquist (1992): Merger dynamics and remnant properties
- Hopkins et al. (2006): Star formation in galaxy mergers