GRAVITY // N-BODY

WEBGPU · EXACT FORCES · SYMPLECTIC

GRAVITY // N-BODY LABORATORY

A direct-summation gravitational N-body simulation. Every particle attracts every other particle — exact O(N²) forces evaluated in a tiled WebGPU compute shader, integrated with a symplectic kick-drift-kick leapfrog scheme. No trees, no approximations, no dependencies.

CAMERA

TOOLS

KEYS

ACCURACY

The HUD tracks total energy E = K + W (kinetic + gravitational potential, including the analytic halo where active) computed on-GPU with the same softened kernel as the forces. A symplectic integrator does not secularly drift — ΔE stays bounded and oscillates. The virial ratio 2K/|W| of a relaxed self-gravitating system settles near 1. Watch both live.

UNITS

G = 1. Each scenario uses natural units (disk scale lengths, Plummer radii). Softening adapts to N as ε ∝ N-1/3.

WEBGPU UNAVAILABLE