# Gravity sandbox > How do planets stay in orbit, and what if you throw one more? A sun and two planets are already orbiting. Aim a new planet, throw it in and watch slingshots, binary stars and collisions happen. Throw planets into orbit around a sun and watch gravity work. Try the figure-eight three-body orbit, a gravity slingshot, binary stars and collisions. - Page: https://how.box/gravity-sandbox/ - Runs entirely in the browser. - License: HowToolbox's own text and data (titles, explanations, FAQs, tool descriptions and schemas, this file) are CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/); AI training and answers are welcome. Attribute "HowToolbox (how.box)" with a link to the page used. Third-party data keeps its own terms; the name and logo are not licensed. Publisher: HowToolbox, contact@how.box. Terms: https://how.box/about/terms/ ## Inputs Answer link: https://how.box/gravity-sandbox/?p={p}&s={s}&t={t}&m={m}&x={x}&y={y}&vx={vx}&vy={vy} - `p` (solar, figure-eight, slingshot, binary or collision): The starting system. Example: `figure-eight`. - `s` (number 0.25 to 4): Simulation speed. Example: `1`. - `t` (on or off): Draw the paths of the bodies. Example: `on`. - `m` (number 0.0001 to 0.5): Mass of the next thrown body relative to the Sun. Example: `0.001`. - `x` (number -3 to 3): Start x of the next thrown body. Example: `2.2`. - `y` (number -3 to 3): Start y of the next thrown body. Example: `0`. - `vx` (number -2 to 2): Start x velocity of the next thrown body. Example: `0`. - `vy` (number -2 to 2): Start y velocity of the next thrown body. Example: `0.67`. Example answer: https://how.box/gravity-sandbox/?p=figure-eight&s=1&t=on&m=0.001&x=2.2&y=0&vx=0&vy=0.67 A complete link carries the primary answer in the page HTML; a missing or invalid value shows the default page. ## Agent tools - `gravity_sandbox_calculate`: N-body gravity in units where G = 1 and the Sun has mass 1 (a circular orbit of radius 1 has speed 1 and period 2π). - Page only: runs on this page (WebMCP), not over MCP. ## How it works Every body pulls on every other body. The pull is stronger for heavier bodies and weaker the farther apart they are. A body that moves sideways fast enough keeps missing the thing it falls towards, and that is an orbit. A little faster and the orbit stretches out, much faster and the body escapes. Newton's law gives the pull between two masses as F = G·m₁·m₂ ÷ r². Here the units are chosen so that G = 1 and the Sun has mass 1. A planet in a circular orbit at distance r then moves at v = √(1 ÷ r), so at r = 1 the speed is 1 and one orbit takes 2π, about 6.28 time units. The page steps all the bodies forward together with the leapfrog method, which keeps the total energy nearly steady for a long time. The drift shown should stay close to zero. Touching bodies merge into one that keeps their total mass and momentum. A gravity slingshot happens when a small body passes close to a moving planet: it steals a little of the planet's motion and leaves faster. The figure-eight is a rare solution for three equal masses found numerically by Cris Moore in 1993 and proved by Chenciner and Montgomery in 2000. Three bodies are otherwise chaotic, so a small change in the throw can end in a very different story. ## FAQ **Why do planets orbit instead of falling into the sun?** They are falling all the time, but they also move sideways fast. Their sideways speed makes them miss the sun again and again, so they curve around it. **How fast do I need to throw for a circular orbit?** At distance r from a sun of mass 1 the speed is the square root of 1 divided by r. At distance 2.2 that is about 0.67, the default. **What is a gravity slingshot?** A small spacecraft passes behind a moving planet and gains speed from its motion. Real probes such as Voyager used it. Try the slingshot system and watch the small probe fly out. **Why does the figure-eight stay stable?** Three equal masses on the right starting positions and speeds chase each other along one figure eight. It is a precise balance, and a small push breaks it. **Is this an exact simulation?** It is a close one. The leapfrog method conserves energy well, but very close passes between bodies are softened to avoid infinite forces, and chaotic systems amplify tiny errors. More: [HowToolbox index](https://how.box/llms.txt) · [Agent Skill](https://how.box/skill.md) · [agent terms](https://how.box/about/agents/)