Tutorial · Orbital Mechanics

Build a Solar System
From Scratch

Learn Kepler's laws, orbital velocity, and n-body gravity by building your own solar system simulation in PHYSIX — no maths degree required.

Contents
  1. Kepler's laws recap
  2. Putting a planet in orbit
  3. N-body system
  4. Escape velocity
  5. Advanced: Slingshot & Lagrange

Kepler's Three Laws

Johannes Kepler derived three empirical laws of planetary motion from Tycho Brahe's observations. Newton later showed they all follow from the inverse-square gravitational force law.

Law 1 — Ellipses

Planets move in elliptical orbits with the Sun at one focus. Eccentricity e = 0 is a circle, e < 1 is an ellipse, e ≥ 1 is escape.

Law 2 — Equal Areas

A line joining a planet to the Sun sweeps out equal areas in equal times. This means planets move faster at perihelion and slower at aphelion.

Law 3 — T² ∝ a³

The square of the orbital period is proportional to the cube of the semi-major axis. This lets you predict periods from distances.

T² = (4π²/GM) · a³Kepler's Third Law. G = 6.674×10⁻¹¹ N·m²/kg². M = central body mass.

Putting a Planet in Orbit

Clear & switch to Space mode

Click 🗑 CLEAR then 🌍 Space in the topbar to enter the astronomical viewport.

Add a Star

Drag a ⭐ Star to the centre of the canvas. Set mass = 2×10³⁰ kg (one solar mass), pinned = true.

Add a Planet

Drag a 🪐 Planet 150 billion metres (1 AU) to the right of the star. Set mass = 6×10²⁴ kg (Earth mass).

Calculate orbital velocity

For a circular orbit: v = √(GM/r). With M = 2×10³⁰ and r = 1.5×10¹¹: v ≈ 29,800 m/s. Set Vy = 29800 m/s on the planet.

Apply Newton's gravity

From the GRV force tab, drag Newton's Gravity (1/r²) onto the planet. Set source = Star, G = 6.674×10⁻¹¹.

Fast-forward & observe

Set speed to 10× or 100×. Watch the planet orbit. Enable Trails to see the elliptical path. Is it a circle? If not, adjust Vy slightly.

v_circular = √(GM/r)Speed required for a circular orbit at radius r around mass M.

Adding More Planets

Once you have one planet orbiting, adding more is straightforward — but the interactions between planets create a rich, complex system that is analytically unsolvable for N ≥ 3. PHYSIX uses a 4th-order Runge-Kutta integrator to keep errors small.

Shortcut Load ☀ Full Solar System from the Presets panel to see all 8 planets with correct masses, distances, and velocities already configured.

Try turning off the pinned flag on the Sun. With the Sun free to move, you'll see it wobble due to gravitational tugs from Jupiter — this is how astronomers detect exoplanets using the radial velocity method.

Escaping the Gravitational Well

v_escape = √(2GM/r)Minimum speed to escape gravity at distance r from mass M. Earth: ~11.2 km/s

Set up the experiment

Place a planet orbiting your star. Note the orbital speed v_circular at distance r.

Increase velocity

Gradually increase the planet's Vy in the properties panel. At v = √2 × v_circular, the orbit changes from ellipse to parabola — the exact escape velocity.

Observe the trajectory

Below escape velocity: closed ellipse. At escape: open parabola. Above escape: hyperbola. The trail makes these conic sections visually obvious.

Slingshot Manoeuvres & Lagrange Points

A gravitational slingshot (gravity assist) uses a planet's gravity well to accelerate a spacecraft without burning fuel. Set up Jupiter in a stable orbit, then send a small body on a hyperbolic flyby trajectory — watch its speed increase after the encounter.

For Lagrange points: with the Sun and Earth in orbit, place a very small test mass (m ≈ 0 kg) at five specific locations and it will remain roughly stationary. The L4 and L5 points (60° ahead and behind Earth) are where the Trojan asteroids cluster.