Quick Answer
Choose a starting setup and press Start simulation. Planets orbit because the sun’s gravity bends their paths. Click on the space to add a planet or a star that starts on a circular orbit around the heaviest body, and use Playback to pause and look closely.
Embed this calculator
Adjust the size if needed, then copy the code below into your page or blog. The calculator will load in an iframe and stay updated automatically.
Table of Contents
- Gravity Simulator
- Quick Answer
- Related Calculators
- How This Gravity Simulator Works
- How to Use the Gravity Simulator
- How the Simulation Works
- Key Terms
- Worked Example
- Real-Life Examples
- This Simulator vs the Real Solar System
- Orbit Time by Distance
- Things to Try
- Common Mistakes to Avoid
- Frequently Asked Questions
- References & Sources
How This Gravity Simulator Works
Gravity is the pull between any two things that have mass. It keeps planets circling the sun and moons circling planets. This simulator lets you watch that pull at work. Every body pulls on every other body, so a few simple rules produce paths that curve, loop and sometimes get very messy.
Start with the sun and four planets to see steady orbits. Switch to two stars orbiting each other to see a binary system. Try the random cluster to see what happens when 40 bodies all pull on each other at once. Then click the space to add your own bodies.
Features:
- Three setups: a sun with planets, a pair of stars, and a random cluster.
- Add bodies: click to drop a small planet, a large planet or a star onto a circular orbit.
- Trails: see the path each body has taken.
- Speed and pause: slow it down, speed it up or freeze it.
How to Use the Gravity Simulator
- Choose a starting setup.
- Set the speed and whether to show trails.
- Press Start simulation.
- Click on the space to add a planet or a star.
- Use Playback to pause, and Stop and clear to start over.
How the Simulation Works
- Gravity: the force between two bodies is F = G × m1 × m2 ÷ r², where m1 and m2 are the masses and r is the distance between them. Double the distance and the pull drops to a quarter.
- Circular orbit: a body orbits a much heavier one in a circle when its speed is v = √(G × M ÷ r). The setups and the bodies you add use this speed.
- Orbit time: one orbit takes T = 2π × √(r³ ÷ (G × M)), so farther planets take longer.
- Movement: each step uses the velocity Verlet method, which keeps orbits steady for much longer than a basic update.
- Softening: a small extra distance in the formula stops the force from becoming huge when two bodies pass very close.
- Mergers: when two bodies touch they merge into one, with their masses added and their combined momentum kept.
Key Terms
- Orbit: the curved path of one body around another because of gravity.
- Binary star: two stars that orbit each other.
- Softening: a small extra distance that keeps the simulated force from becoming huge.
- Merger: two bodies joining into one when they touch.
Worked Example
- In the sun and planets setup the sun has a mass of 1,000 units and G is 1.
- A planet 100 units away needs a speed of √(1 × 1000 ÷ 100) = √10 = 3.16 units per time unit.
- One orbit takes 2π × √(100³ ÷ 1000) = 2π × √1000 = 2π × 31.6 = 199 time units.
- A planet at 200 units is twice as far, so its orbit takes 2π × √(200³ ÷ 1000) = 562 time units, which is 2.83 times longer.
Real-Life Examples
- Students: see why a planet 2 times farther away takes about 2.8 times as long to orbit.
- Teachers: show orbits, binary stars and collisions on a classroom screen.
- Curious people: try what happens if a second star arrives in a solar system.
- Writers and game designers: test how a made-up system behaves before building it.
This Simulator vs the Real Solar System
- This simulator: a flat, 2D system in made-up units, with a few bodies, so you can watch the cause and effect.
- The real solar system: three dimensions, eight planets, moons, asteroids and real masses and distances, with sizes that cannot be drawn to scale on a screen.
- The same idea: both follow Newton’s law of gravity, so the shapes of the orbits match what real astronomy predicts.
Orbit Time by Distance
| Distance | Orbit speed | Time for one orbit |
|---|---|---|
| 60 | 4.08 | 92 |
| 100 | 3.16 | 199 |
| 150 | 2.58 | 365 |
| 210 | 2.18 | 605 |
Things to Try
- Add a big planet near a small one: watch the small one get pulled around or thrown out.
- Drop a star into the sun and planets setup: the planets’ orbits are pulled out of shape.
- Compare the two setups: a binary pair circles a point between them instead of a single center.
- Use the cluster: clumps form and merge as the bodies fall together.
- Pause and add: pause, think about where to add a body, then run again.
Common Mistakes to Avoid
- Expecting real distances. The units are made up, so use it to see patterns, not to read real numbers.
- Adding too many stars. Several heavy bodies make a messy system that soon throws bodies out.
- Thinking a planet falls straight in. A body with sideways speed keeps missing the sun, which is what an orbit is.
- Forgetting to start. Press Start simulation first; clicks only add bodies once it is running.
- Expecting stable systems with many bodies. Three or more bodies pulling on each other can be chaotic.
Frequently Asked Questions
A program that shows how bodies pull on each other and move because of gravity.
Yes, with no sign-up and no download.
Start the simulation, choose what to add, and click on the space.
They have sideways speed, so as they fall toward the sun they keep missing it.
No. It is a simple 2D model in made-up units that follows Newton’s law of gravity.
They merge into one, keeping their combined mass and momentum.
Yes, set Playback to Paused.
A close pass or a heavy new body can speed one up enough to escape the system.
The simulator uses G = 1 in its own units, so the numbers are relative.
It uses the velocity Verlet method, which is good at keeping orbits stable.
Yes. Tap on the space to add a body.
Up to 120 in total.
Two stars bound by gravity, each orbiting the point between them.
No. Take a screenshot if you want to keep a picture.
References & Sources
| Source | Used For | Link |
|---|---|---|
| Wikipedia, Newton’s law of universal gravitation | The inverse-square law F = G m1 m2 / r squared. | https://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation |
| Wikipedia, Circular orbit | Circular orbit speed v = sqrt(GM/r) and orbital period T = 2 pi sqrt(r cubed / mu). | https://en.wikipedia.org/wiki/Circular_orbit |
| Wikipedia, N-body simulation | How many-body systems are simulated, and the softening parameter. | https://en.wikipedia.org/wiki/N-body_simulation |
| Wikipedia, Verlet integration | The velocity Verlet method used to update positions and speeds. | https://en.wikipedia.org/wiki/Verlet_integration |