# N-Body & Three-Body Orbit Simulator > Three-body periodic orbits and your own planar n-body systems, with an energy-drift report. Simulate point masses under Newtonian gravity in a plane: published three-body periodic orbits (figure-eight, butterflies, moths, yin-yang and more from Šuvakov & Dmitrašinović 2013 and the 10-digit refinements of Li & Liao 2017), Lagrange’s triangle, the chaotic Pythagorean problem, or up to 12 bodies of your own. Choose an adaptive Dormand–Prince RK45 or a symplectic Verlet or Yoshida integrator and get the orbit plot, the energy, momentum and angular-momentum drift, the closest approach and how far a periodic orbit is from its start after each full period. Part of the Proofline math notebook. Part of usefulweb.app (https://usefulweb.app/). Part of [Proofline](https://proofline.usefulweb.app/) (ownerApp: proofline). Results are deterministic calculations from the inputs and the listed assumptions; the API returns exactly what the web page shows. ## Use it - Human interface: https://prooflinenbody.usefulweb.app/ (interactive tool at https://prooflinenbody.usefulweb.app/tool) - JSON API: POST https://prooflinenbody.usefulweb.app/api/v1/calculate with a JSON object of inputs (schema: https://prooflinenbody.usefulweb.app/api/v1/tool) - OpenAPI: https://prooflinenbody.usefulweb.app/openapi.json - MCP (Streamable HTTP): https://prooflinenbody.usefulweb.app/mcp - tool `proofline_nbody` ## Inputs - preset (select): Initial conditions - bodies (textarea): Bodies (custom: one per line) - One body per line: an optional name, then mass, x, y, vx and vy (G = 1 units unless you change G). At most 12 bodies. Used when “My own bodies” is selected. - duration (number): Duration (time units) - Empty: one period for the periodic presets, 70 for the Pythagorean problem, 10 for your own bodies. - method (select): Integrator - tolerance (number): Tolerance (RK45) - Relative error per step of the adaptive method. - step (number): Step size (fixed-step methods) - Empty: the period (or the duration) divided by 20,000. - G (number): Gravitational constant G - softening (number): Softening length - Plummer softening ε: the force uses r² + ε², which tames close encounters but changes the physics slightly. - outputPoints (integer): Output points ## Method - Each body feels a = Σ G·mⱼ·(rⱼ − rᵢ)/(|rⱼ − rᵢ|² + ε²)^{3/2} from all others (pairwise, O(n²)); positions and velocities form one state vector. - RK45 is the numerical engine’s Dormand–Prince 5(4) with adaptive steps (relative tolerance as set, absolute tolerance 100× smaller). Velocity Verlet (kick–drift–kick) and Yoshida’s fourth-order composition of three Verlet steps (weights 1/(2 − 2^{1/3}) and −2^{1/3}/(2 − 2^{1/3})) are symplectic: their energy error stays bounded instead of drifting, as long as the step resolves the closest approaches. - Conservation checks: total energy E = Σ ½mv² − Σ G·mᵢmⱼ/r, momentum and angular momentum are compared with their initial values at every output point. For periodic presets the step is aligned with the period and the phase-space distance |state(k·T) − state(0)| is reported for each whole period. - Verified: the Chenciner–Montgomery figure-eight returns to within 1e-7 after one period; the 10-digit Li–Liao orbits close to about 1e-8; the 5-digit Šuvakov–Dmitrašinović values close to about 1e-3, as their precision allows; Lagrange’s triangle rotates rigidly; and in the Pythagorean problem the lightest body (m = 3) escapes while the other two form a binary, as Szebehely and Peters found. ## Limits - A teaching and exploration tool: planar point masses only (no collisions, no relativity, no tides). Chaotic systems amplify every rounding error, so long runs show one possible future, not the future.