A modern edition of Bob Vanderbei’s star-cluster simulation. Watch many bodies trace one gravitational story.
About the model & this update
Every body attracts every other body through Newtonian gravity. This is a direct, three-dimensional N-body calculation with up to 1,000 bodies. Gaussian clusters have no special central body: every star has an independently sampled mass uniformly distributed from 0.5 to 1.5 original mass units. The exponential and ring setups retain their original central body of mass 1,000. Colors identify bodies; they do not represent stellar temperatures. Displayed radii are exaggerated, with a gentle mass-based variation. Dots and their halos become smaller with distance from a virtual viewer, including when zooming out. Their minimum and maximum sizes are bounded for readability, including a minimum dot radius of 0.65 screen pixels. The sizing reference follows the chosen zoom; escaping stars cannot make the remaining cluster fade. Positions and trails retain an orthographic projection for clear orbit inspection.
The Gaussian presets sample x, y, and z independently from normal distributions with the same standard deviation of 1 original length unit. Finite random samples have small differences in measured spread. The exponential preset keeps the original radial distribution and samples directions uniformly over the sphere. Gaussian velocities start as independent random normal components; their mass-weighted mean is removed and a common scale sets the global initial virial ratio 2K/(−Σ r·F) to 1, using the softened force. This balances the initial overall kinetic energy against gravity; it does not make the cloud an exact equilibrium. The cloud can evolve, contract, scatter stars, or develop a dense core naturally. Exponential-cloud velocities remain tangential with randomly oriented orbital planes. The orbital ring and figure-eight setups are intentionally planar. The legacy “Antimatter” option originally called the same Gaussian initializer and used only positive masses. It continues to share the Gaussian initializer, including the new mass distribution, with its alternative time settings; annihilation or exotic gravity is not simulated.
Four distinct integrators are implemented: explicit Euler, leapfrog (kick–drift–kick), classical RK4, and a fourth-order acceleration-and-jerk Hermite predictor–corrector. The original Hermite menu entry ran leapfrog; it now runs Hermite. Energy error is measured against the energy at reset, or against a new reference when softening changes.
Gravity uses a smooth Plummer-softened force, replacing the original abrupt cutoff below distance 0.01. Set softening to zero for unsoftened point masses. Close encounters can require much smaller steps. There are no collisions, mergers, stellar evolution, or adaptive time steps. A low total-energy error alone does not guarantee an accurate trajectory.
The figure-eight initial velocities have been multiplied by √G to match the original gravitational constant G = 1.177 × 10⁻⁴. The ring’s circular speed includes the other orbiting bodies’ radial attraction. Each setup begins with zero total momentum. Time retains the original page’s year label; lengths and masses retain its numerical units without assuming a new physical calibration.
Changing initial conditions takes effect with Reset. Reset repeats the same random seed; New arrangement uses a new seed. Trails are recorded in the rotating coordinate frame, so changing its rotation rate clears them. Dragging rotates the view without changing the physics.
Playback is capped at 30 frames per second with a computation budget. Large systems or expensive integrators may run slower than the requested steps per frame. The simulation starts paused, stops when hidden, and does not continuously redraw while idle.
Original simulation: Robert Vanderbei. Numerical reference: The Art of Computational Science, Hut & Makino. Standalone HTML; no external libraries, fonts, or internet connection required.