Skip to content
ScienceQuest

Orbit Simulator

SimulatorSchool Updated

Support ScienceQuest on Buy Me a Coffee (opens in a new tab)

Launch a body around a central mass and watch the orbit change from circle to ellipse to escape as the speed rises, with Kepler’s laws visible throughout.

Simulator

Orbit shape
Set entirely by the launch speed relative to circular and escape.
Circle
Eccentricity
0 is a circle, below 1 an ellipse, exactly 1 a parabola, above 1 a hyperbola.
0
Period
T² = a³/M in these units, which is Kepler’s third law with no constant.
1 yr
Closest approach
1 AU
Furthest point
1 AU
Speed now
Escape speed at the launch distance is 8.886 AU/yr.
0 AU/yr
Parameters
× circular

1 is a circle.

MoreLessabout Launch speed

From √2 ≈ 1.414 up it escapes and never returns, so 1.41 still comes back and 1.42 does not.

AU

1 AU is 149.6 million km, about the Earth’s average distance from the Sun.

M☉

In solar masses. Heavier center, faster orbit at the same radius.

The dashed line is the exact conic from the closed-form solution. The solid line is where the integration actually put the body. They should be indistinguishable.

Distance from the central mass against time. A circle is a flat line; an ellipse oscillates between periapsis and apoapsis.
Speed against time, peaking at closest approach and bottoming out at the furthest point, which is Kepler’s second law.
Cite this tool

Citing this tool

Last updated . Add the date you accessed it as well, which a citation of a page that can change asks for. If a specific result matters, cite the permalink from the tool’s share row instead of this page: it reproduces the exact parameters.

On the syllabus: AP Physics 1, Unit 2: Force and Translational Dynamics; AP Physics 1, Unit 6: Energy and Momentum of Rotating Systems.

Teaching with this? You can put it on a class page or LMS for free, with no ads inside the frame. Get the embed code.

The equation

T2=a3M(AU, yr, M⊙)T^{2} = \frac{a^{3}}{M}\quad(\text{AU, yr, } M_{\odot})

Kepler’s laws (1609, 1619) with Newton’s law of gravitation (1687)

What are Kepler’s three laws of planetary motion?

Kepler’s laws describe how planets orbit the Sun: (1) planets orbit the Sun in ellipses with the Sun at one focus; (2) a line connecting planet to Sun sweeps equal areas in equal times; and (3) orbital period squared is proportional to semi-major axis cubed: T2 = (4π2 / GM) · a3.

One slider, every possible orbit

Launch a body sideways at some distance from a star and the shape of what follows depends on exactly one thing: how its speed compares with the circular speed at that distance, v_c = √(GM/r). That is why the control here is a multiple of circular speed rather than a value in kilometers per second. The interesting number depends on the distance and the mass, so a raw speed slider would put the whole interesting range in a sliver at one end.

  • Below 1. Gravity wins, the body falls inward, and the launch point is the furthest point of an ellipse.
  • Exactly 1. A circle.
  • Between 1 and √2. An ellipse again, but now the launch point is the closest approach.
  • Exactly √2 ≈ 1.414. A parabola. The body escapes, arriving at infinity with precisely zero speed left.
  • Above √2. A hyperbola. It escapes with speed to spare.

Why escape is always √2 times circular

Circular motion needs the gravitational pull to supply exactly the centripetal force, which gives v² = GM/r. Escaping needs enough kinetic energy to climb out of the potential well entirely, which gives v² = 2GM/r. The ratio is therefore √2 at every distance from every mass, which is one of the very few numbers in this subject that never changes. Earth’s circular speed at our orbit is 29.8 km/s and escape from that orbit is 42.1 km/s.

Kepler’s laws, visible rather than asserted

The first law says orbits are ellipses with the star at one focus, not at the center. Set the speed to 0.6 and watch: the star sits noticeably off to one side of the ellipse. The dashed line is the exact conic from the closed-form solution.

The second law says the line from star to body sweeps equal areas in equal times, which means the body moves fastest when closest. That is the speed graph: it peaks at closest approach and bottoms out at the furthest point. It is not an extra rule, it is conservation of angular momentum.

The third law says T² ∝ a³. In the units here, astronomical units, years and solar masses, the constant is 1 to within a few parts in 100,000, so T² = a³/M. Set the distance to 4 AU and the period comes out at 8 years, because 4³ = 64 and √64 = 8. That clean arithmetic is the reason for these units rather than SI.

The mass of the orbiting body does not appear

Nowhere in this simulator do you enter the mass of the thing doing the orbiting, and that is not an omission. Gravitational acceleration is GM/r² using the central mass alone; the orbiting mass cancels out of the equation of motion exactly as it does for a falling stone. A satellite and a bowling ball released side by side follow identical orbits.

What this model leaves out

The central mass is fixed in place. In reality both bodies orbit their common center of mass, and fixing the star is an error of a few parts in a million for the Sun and the Earth and about one part in a thousand for Jupiter, so it costs little here. It stops being reasonable for comparable masses: a binary star has both components tracing visible ellipses about a point between them.

There is also only one central body. Adding a second turns it into the three-body problem, whose solutions can be arbitrarily complex, so the closed-form conic drawn underneath the trail would simply not exist. And there is no relativity, which matters for Mercury by about 43 arc seconds of perihelion advance per century.

Common mistakes

  • Putting the star at the center of the ellipse. It sits at a focus. For a circle the two coincide, which is why the mistake survives.
  • Thinking the launch point is always the closest approach. Only above circular speed. Below it the launch point is the furthest point, and a faster launch enlarges the orbit on the far side of the star while the launch point stays put as apoapsis.
  • Believing an orbiting object has no gravity acting on it. It is in freefall, which feels like weightlessness and is nothing like the absence of gravity. The acceleration is what curves the path.
  • Using the semi-major axis and the launch distance interchangeably. They are equal only for a circle.
  • Expecting escape speed to depend on direction. It does not, because it is an energy condition. Launching straight up or sideways needs the same speed to escape, though the paths differ enormously.
  • Quoting a period without a mass. Kepler’s third law has the central mass in it. Double the mass and the period at the same radius falls by √2.

Sources

OpenStax University Physics Volume 1, sections 13.3 for escape speed, 13.4 for circular orbital speed, and 13.5 for Kepler’s laws, the focus, the common center of mass and the conic sections. NASA’s fact sheets for the Earth, the Sun and Jupiter for the masses, the Earth’s 29.78 km/s and its eccentricity, and its comet fact sheet for Halley’s. JPL’s astrodynamic parameters for the astronomical unit, the Sun’s GM and the Julian year, which put GM at 39.4769 AU³/yr² against 4π² = 39.4784. Chenciner, Three body problem, Scholarpedia 2007, for the three-body problem. Will, The Confrontation between General Relativity and Experiment, Living Reviews in Relativity 2014, for Mercury’s 43 arcseconds per century.

Model and assumptions

The method, what it assumes and how accurate it is
Method
Runge-Kutta 4th order
Largest step
0.0005 years
Repeatability
Deterministic. The same link gives the same numbers on any machine.

What it assumes

  • Inverse-square gravity from a central mass held fixed, so the barycenter does not move.
  • Units are astronomical units, years and solar masses, which makes GM exactly 4 pi squared for the Sun.
  • One orbiting body only: no perturbations from other planets and no relativistic correction.

Where it stops holding. Comparable masses, where both bodies orbit their common center of mass. For the Sun and the Earth the fixed-center error is a few parts in a million; for Jupiter it is about one part in a thousand.

Numerical accuracy

Estimated error
3.1e-12 AU in the distance from the central mass, about 3.1e-12 of the largest value reached
How that was obtained
Running the same problem again at half the step changed the answer by at most 2.9e-12 AU over 1 year, exactly one orbit. Richardson extrapolation of that difference gives the figure above.
Observed order
3.95, measured from a second halving rather than assumed
Conditions
1 AU, 1 solar mass, circular, the shipped defaults

An eccentric orbit is harder. At 0.7 of circular speed, an ellipse of eccentricity 0.51, the same step gives 8.3e-10 AU over one year, because perihelion is where a fixed-step integrator does its worst work.

Common questions

Why is escape speed always √2 times the circular speed?

Because of how the two are defined. A circular orbit needs v² = GM/r, while escaping needs enough kinetic energy to cancel the gravitational potential, v² = 2GM/r. The ratio of the two speeds is therefore √2, about 1.414, at every distance from every mass. It is one of the few numbers in orbital mechanics that never changes.

Why does launching slower than circular speed not make the orbit bigger?

It makes it smaller, and the launch point becomes the furthest point rather than the nearest. Launch below circular speed and gravity wins, so the body falls inward, speeds up, swings around and comes back to exactly where it started. Launch above circular and the opposite happens: the launch point becomes the closest approach and the body climbs away from it.

What is eccentricity?

A number describing how stretched the orbit is. Zero is a perfect circle, anything between 0 and 1 is an ellipse, exactly 1 is a parabola and above 1 a hyperbola. Earth’s orbit is 0.017, so it is very nearly circular; Halley’s comet is 0.967. Parabolic and hyperbolic orbits both escape and never return, which is why the period readout says never for them.

Does the orbiting body’s own mass matter?

Not for the shape or the period. Gravitational acceleration is GM/r² using the central mass only, so the orbiting mass cancels out exactly as it does for a falling object, which is why the readouts here never ask for it. It would matter if the two masses were comparable, because then both orbit their common center of mass and the central body would visibly move too.