An N-body gravitational simulation of the S-star cluster orbiting Sagittarius A* — the supermassive black hole at the center of the Milky Way.
| Rotating view | Fixed view |
|---|---|
![]() |
![]() |
This simulation models five real stars from the S-star cluster (S2, S8, S12, S13, S14) under Newtonian gravity, orbiting a central black hole of ~4 million solar masses. Each timestep advances the simulation by 6 hours; the animation spans roughly 2 simulated years.
Masses, distances, and initial velocities are approximate — this is a visualization, not a precision model.
- Gravitational force: F = Gm₁m₂ / r²
- Integration: Euler method, 6-hour timestep
- Central mass: 4 × 10⁶ solar masses (scaled ×5 to produce visually interesting orbital periods)
- Coordinate system: AU, centered on Sgr A*
- Python 3
- Matplotlib — animation via
FuncAnimation+PillowWriter
pip install matplotlib pillow
python main.pyOutputs sgr_A.gif directly — no post-processing needed.
This project started as a pygame prototype written with ChatGPT — a good example of how accessible AI coding assistants have made exploratory science projects. It was later rebuilt in matplotlib by Claude Sonnet 4.6 (via Claude Code, Anthropic's agentic coding tool), which rewrote the rendering pipeline, replaced the gif export shell script with native matplotlib output, and updated this README.
The delta between those two tools reflects how quickly the space is moving: from autocomplete-style prompting to a fully agentic workflow that reads your codebase, reasons about tradeoffs, and executes multi-step changes end to end.

