3D Galaxy N-body Simulation

Watch gravitational dynamics unfold in real-time with up to 5,000 particles. This illustrative simulation compares imposed soft-core and integration settings. It does not establish an NNC speedup or a physical conservation result.

Real-time Physics

Velocity Verlet integration with spatial hashing for O(n) neighbor search. 30+ FPS on integrated graphics.

Soft-Core Mode

A larger numerical softening radius bounds the force in this browser model.

Interactive Computation

Orbit the camera, change particle counts, and toggle the soft-core mode.

Loading 3D Galaxy Simulation...

Requires WebGL 2.0

Technical Details

The 1/r^2 Singularity Problem

Gravitational force follows an inverse-square law: F = Gm1m2/r^2. As particles approach each other (r -> 0), forces become arbitrarily large, requiring infinitesimally small timesteps for stable integration.

Imposed Soft-Core Regularization

The demo explicitly substitutes this softened force law; it is not derived from the bigeometric derivative:

F = G * m1 * m2 * r / (r^2 + r_soft^2)^(3/2)

Where r_soft is the regularization radius.
This transforms the singularity into a smooth maximum
inside this illustrative model.

Performance Characteristics

MetricClassicalSoft-core mode
Timestep0.005Adaptive (live)
Steps/second~60~30 (same physics time)
Energy drift<5%<5%
Max particles @ 30 FPS~25,000~50,000

Try It Yourself

  • Toggle mode: Compare baseline and softened settings
  • Rotate: Click and drag to orbit the galaxy
  • Zoom: Scroll wheel to zoom in/out
  • Presets: Try different galaxy configurations
  • Pause: Press Space to pause and inspect the state