Flow Lab

Syllabus / Module 16: Capstone Builds

Lesson 16.5

Capstone: Orbital Transfer Planner

Build an orbital simulator with symplectic integration, maneuver nodes, Hohmann and bi-elliptic transfers, and a simple optimizer.

Written byClaude Sonnet

🌊
Why this matters for simulation: Integration accuracy over long times — a lesson for every simulator.

By the end of this lesson you can…

  • Write the two-body problem in canonical units ($\mu = 1$, circular speed $1$ at radius $1$), and compute the conserved energy, angular momentum and Laplace-Runge-Lenz vector of a state as a way to test any integrator.
  • Compare Euler, RK4, velocity Verlet and a fourth-order Yoshida composition on a Kepler orbit by measured energy drift, phase error and cost, and explain why the symplectic methods keep the energy bounded while RK4 drifts.
  • Show by running it why a fixed step fails at eccentricity $0.9$, why a naive state-dependent step breaks the symplectic property, and what a time-reversible adaptive step costs.
  • Compute Hohmann, bi-elliptic and plane-change burns from the vis-viva equation, and verify numerically that the bi-elliptic transfer beats Hohmann only when the radius ratio exceeds $11.94$.
  • Patch two conics together for an Earth to Mars transfer, compute the departure and capture burns, the launch lead angle and the synodic period, and say which approximations of the patch are visible in the numbers.
  • Solve Lambert's problem with universal variables and with Newton shooting, and say why the first needs no initial guess and the second needs a propagator.
  • Plan a transfer with maneuver nodes in a lab, read its energy diagnostics, and list what the model leaves out: perturbations, oblateness, drag and third bodies.
On this page
·
  1. What we are building
  2. Step 1: the two-body problem and what it conserves
  3. Step 2: four integrators on a Kepler orbit
  4. Order and cost
  5. The eccentric orbit
  6. Step 3: impulsive maneuvers
  7. Hohmann
  8. Bi-elliptic
  9. Plane change
  10. Step 4: patched conics, Earth to Mars
  11. The patch and where it leaks
  12. Step 5: Lambert’s problem and shooting
  13. Rendezvous: when to go
  14. Step 6: the planner
  15. Honest limits
  16. Concept checks
  17. Problems
  18. Where the course ends
  19. Key Takeaways

16.4 Capstone: Drum & Membrane Mode Synthesizer ended by pointing at a problem with the opposite character. A drum is linear and damped, so the integrator’s errors die out and a modal sum is exact. An orbit is nonlinear and conservative: nothing damps, every error accumulates for as long as you integrate, and a method that is accurate and stable in the sense of 4.1 Local Error, Global Error & Order can still make a satellite spiral out of its orbit. This capstone builds an orbital transfer planner around that difficulty. We write down the two-body problem and the three quantities it conserves, use them to measure what four integrators do to a Kepler orbit, compute the classical burns in closed form and check them by flying them, patch two orbits together for a trip from Earth to Mars, recover a transfer from its endpoints with a Lambert solver and with Newton shooting, and finish with a lab where you place maneuver nodes on an orbit and read the energy diagnostics.

▶ Video The two-body invariants, four integrators on a Kepler orbit, the Hohmann and bi-elliptic transfers, the Earth to Mars patch, and a Lambert solve compared with shootingcaptions only
Transcript
  1. The last capstone is a spacecraft under one point mass, in units where mu is 1. Three quantities are conserved along every orbit: the energy, the angular momentum, and the Laplace Runge Lenz vector, which points at periapsis and keeps the ellipse closed. We know their true values, so they are the integrator's report card. A long RK4 run at e equal 0.6 held the energy to 2.9 times 10 to the minus 11 over ten orbits.
  2. Now four integrators on an e equal 0.5 orbit, 200 steps per orbit. Euler pumps the energy up by 93 percent in ten orbits. RK4 wins at ten orbits, but its energy error grows linearly: 9.9 times 10 to the minus 6, then 9.3 times 10 to the minus 5, then 9.3 times 10 to the minus 4. Yoshida four is symplectic, and its error is 2.017 times 10 to the minus 5 at ten, a hundred and a thousand orbits. Verlet sits flat at 2.689 times 10 to the minus 3.
  3. Halve the step and Verlet's error falls by 4, Yoshida's by 16, and RK4's by 27 to 30. At equal cost, 1200 force evaluations per orbit over 100 orbits, Yoshida four wins, with an energy error of 1.27 times 10 to the minus 6. But a bounded energy is not a bounded position. Yoshida's phase error still grows linearly: 3.31 times 10 to the minus 3, then 3.31 times 10 to the minus 2, then 0.326.
  4. At eccentricity 0.9 a fixed Verlet step of 420 per orbit is wrong by 0.6132 of its energy within a few orbits. Make the step depend on r to the three halves and it looks fine at ten orbits, 2.402 times 10 to the minus 3, then drifts: 1.042 times 10 to the minus 2, then 8.894 times 10 to the minus 2 at a thousand. The time symmetric rule of Hut, Makino and McMillan stays flat at 1.485 times 10 to the minus 3, for about four times the force evaluations.
  5. An impulsive burn changes the velocity at a fixed position, so every transfer is vis-viva arithmetic: v squared is 2 over r minus 1 over a. The Hohmann ellipse from radius 1 to radius 4 has semi-major axis 2.5 and eccentricity 0.6. The burns are 0.2649111 and 0.1837722, a total of 0.4486833 of the circular speed, in 12.41824 time units. Flown with Verlet at step 0.01, the final orbit has eccentricity 1.10 times 10 to the minus 4.
  6. Three burns can beat two. In the limit of an infinite apoapsis the total is root 2 minus 1 times 1 plus 1 over root R. Bisection finds where it crosses Hohmann: R star is 11.93876552. At R equal 20 with r b equal 60 the total is 0.5207391 against 0.5347314, a saving of 2.6 percent, but the flight takes 1323.94 time units against 106.889. That is a mission decision, not a numerical one.
  7. Patched conics turns a three-body trip into a chain of two-body problems. About the Sun it is a Hohmann ellipse, with an excess speed of 2.944689 kilometres per second leaving the Earth. The textbook burn from a 6778 kilometre orbit is 3.569119 kilometres per second, and capture at Mars costs 2.079937. The flight takes 258.8658 days, in which Mars moves 135.66 degrees, so it must lead the Earth by 44.3442 degrees. Windows repeat every synodic period, 779.949 days, about 26 months.
  8. But fly the burn. Leaving the sphere of influence, 924647 kilometres out, the spacecraft still has 3.087614 kilometres per second, not 2.944689, because the speed at infinity is not the speed at the patch. The orbit overshoots Mars by 0.035 astronomical units. Correct the burn so the speed at the sphere of influence is v infinity: 3.530693 kilometres per second. The aphelion is 1.524818 against Mars at 1.523679, a miss of 0.0011. Under a tenth of a percent, once the potential is respected.
  9. The inverse question is Lambert's problem: given two positions and a flight time, find the velocity. Shooting treats it as root finding with Newton's method, and the miss falls 0.4686222502, 0.02925064, 1.1451 times 10 to the minus 4, 2.0175 times 10 to the minus 9: quadratic convergence. But it converges to the answer of its propagator. RK4 at step 0.05 is wrong by 3.375 times 10 to the minus 8, Verlet at 0.01 by 1.375 times 10 to the minus 5. The universal variable solver needs no guess and is exact to about 10 to the minus 14.
  10. Honest limits. A point mass has no oblateness, no drag and no third bodies. Impulsive means infinitely strong. The planet constants and the step rule are from memory, and the Lambert solver is single revolution and prograde. This is a planning sketch with verified arithmetic. And that is the end of the course: sixteen modules and five capstones, and one habit. A simulation passes if it conserves what should be conserved, converges at the order it claims, and agrees with an independent calculation. Everything beyond is the same ideas with different words.

What we are building

A spacecraft far from every other body, under the pull of a single point mass, moves according to the Kepler problem of 12.7 Orbital Mechanics,

r¨=−μ r∥r∥3.\ddot{\mathbf r} = -\mu\,\frac{\mathbf r}{\lVert\mathbf r\rVert^{3}}.

Everything in this capstone uses canonical units: μ=1\mu = 1, and the start orbit is a circle of radius 11. Then the circular speed is 11, the period of a circular orbit is 2π2\pi, and an orbit of semi-major axis aa has period 2πa3/22\pi a^{3/2}. A velocity change (a delta-v) is quoted as a fraction of the circular speed of the start orbit. To turn the lab’s numbers into kilometres and seconds, we pick the start orbit to be a circle of radius 67786778 km about the Earth (an altitude of about 400400 km on a radius of 63786378 km, the radius being from memory) with μ⊕=398600.4418\mu_{\oplus} = 398600.4418 km3^3/s2^2 (the standard value, from memory). That gives a velocity unit of 7.6686367.668636 km/s, a time unit of 883.860883.860 s, and a 2π2\pi time-unit period of 92.55892.558 minutes. Nothing in the numerical results depends on this choice; it is a label.

Every result below states the units, the integrator and the step. Each number was produced twice: once by the lab’s own functions run under node, and once by a separate Python program that reimplements the steppers from scratch in plain floating point, uses scipy’s DOP853 integrator at relative tolerance 10−1210^{-12} as an exact orbit, and uses scipy’s brentq, minimize_scalar and fsolve for the root finding. The two agreed to a relative 10−610^{-6} or better, except in the places I say. The things that are from memory are marked: the physical constants for the Sun, Mars and the planetary orbits, the Hut-Makino-McMillan time-symmetric step rule, and the regularised formulations that I name without implementing.

Six steps build the lab, and then the lab itself:

  1. the two-body problem, its three invariants and units;
  2. four integrators compared on a Kepler orbit, and the step-size problem at eccentricity 0.90.9;
  3. impulsive maneuvers: Hohmann, bi-elliptic, plane change;
  4. patched conics, Earth to Mars;
  5. Lambert’s problem and shooting;
  6. the planner.

Step 1: the two-body problem and what it conserves

With μ=1\mu = 1 and the state (x,y,vx,vy)(x, y, v_x, v_y) in the orbital plane, three quantities are constant along every solution. They are the specific energy, angular momentum, and the Laplace-Runge-Lenz (LRL) vector,

E=12v2−1r,h=xvy−yvx,e=(v2−1r)r−(r⋅v) v.E = \tfrac12 v^2 - \frac1r, \qquad h = x v_y - y v_x, \qquad \mathbf e = \left(v^2 - \frac1r\right)\mathbf r - (\mathbf r\cdot\mathbf v)\,\mathbf v .

The energy is conserved because the force is the gradient of −1/r-1/r, and the angular momentum because the force is central, as in 14.7 N-Body Simulation. The LRL vector is the unusual one, a hidden symmetry of the inverse-square law. It points from the focus toward periapsis, its length is the eccentricity, and its conservation is the reason the orbit is a closed ellipse that does not precess. The three are not independent: ∥e∥2=1+2Eh2\lVert\mathbf e\rVert^2 = 1 + 2Eh^2, which you can check from the definitions. The orbital elements follow:

a=−12E,e=∥e∥,rp=a(1−e),ra=a(1+e),T=2πa3/2.a = -\frac{1}{2E}, \quad e = \lVert\mathbf e\rVert, \quad r_p = a(1 - e), \quad r_a = a(1 + e), \quad T = 2\pi a^{3/2}.

Also useful is the vis-viva equation v2=2/r−1/av^2 = 2/r - 1/a, which is the definition of EE rearranged and is the engine of every burn calculation in step 3.

These are the integrator’s report card. Conservation is the one thing we know the true answer to, so a numerical orbit that violates it is wrong by exactly that much, and the violation is cheap to measure. The first cell runs a long RK4 reference orbit with e=0.6e = 0.6 (units μ=1\mu = 1, 40004000 steps per orbit for 1010 orbits) and prints how well the invariants hold. In that run E0=−0.5E_0 = -0.5, h0=0.8h_0 = 0.8 and e=(0.6,0)\mathbf e = (0.6, 0), and the largest drift of EE over the ten orbits was 2.9×10−112.9 \times 10^{-11}.

🐍 PythonStep 1: energy, angular momentum and the LRL vector along a numerical orbit
⌘/Ctrl + Enter

Now you write the function that every later step leans on. It takes a state and returns the invariants and the orbital elements.

🧪 Coding exerciseExercise: the invariants and elements of a state
⌘/Ctrl + Enter

Step 2: four integrators on a Kepler orbit

The methods, in order of what they cost per step (the number of force evaluations, since gravity is the expensive part in a many-body code):

  • Euler, one evaluation, first order. It is in the lab for contrast. It heats the orbit.
  • RK4, four evaluations, fourth order (4.3 Runge–Kutta Methods & Butcher Tableaux). Accurate for a given step, but not symplectic.
  • Velocity Verlet, one evaluation per step (the second force is reused as the first of the next step), second order and symplectic. In kick-drift-kick form: v←v+h2g(x)v \leftarrow v + \tfrac h2 g(x), x←x+hvx \leftarrow x + hv, v←v+h2g(x)v \leftarrow v + \tfrac h2 g(x), where gg is the acceleration.
  • Yoshida 4, three evaluations, fourth order and symplectic. It is three Verlet substeps with weights w1=1/(2−21/3)=1.3512072w_1 = 1/(2 - 2^{1/3}) = 1.3512072, w0=−21/3w1=−1.7024144w_0 = -2^{1/3}w_1 = -1.7024144 and w1w_1 again, so that the weights sum to 11 and the second-order error terms cancel. One of the substeps runs backward in time, which is what the negative weight means.

A symplectic method (4.7 Energy & Symplectic Integrators) exactly conserves a nearby Hamiltonian, the original plus a small correction that is a power series in hh. The energy then does not drift but oscillates, with a bounded amplitude of order hph^p for a method of order pp, over times that are exponentially long in 1/h1/h (from memory, backward error analysis). The orbit is a faithful ellipse of a slightly different problem. RK4 is not symplectic, so it has no such guarantee, and it dissipates a tiny amount at every step in a way that adds up.

All measurements below start at periapsis of the orbit with a=1a = 1 and e=0.5e = 0.5 (period 2π2\pi, units μ=1\mu = 1), use a fixed step of 2π/2002\pi/200 unless stated, and compare with the exact orbit. The cell after this paragraph runs all four and prints the largest relative energy error over ten orbits and the position error after ten whole orbits, which is the distance between where the spacecraft is and where it began, because after whole periods the exact answer is the starting point. That position error is dominated by the phase: the orbit has the right shape and the wrong clock.

🐍 PythonStep 2: four integrators on an e = 0.5 orbit, 200 steps per orbit, 10 orbits
⌘/Ctrl + Enter

The results, as the cell prints them (max over the run of ∣E−E0∣/∣E0∣\lvert E - E_0\rvert/\lvert E_0\rvert, and the position error ∣rend−r0∣\lvert\mathbf r_{\text{end}} - \mathbf r_0\rvert after 1010 orbits):

methodmax energy errorposition error at 10 orbits
Euler0.93451.0688
RK49.935e-69.40e-4
Verlet2.689e-30.4291
Yoshida 42.017e-53.31e-3

Euler is useless: in ten orbits it has pumped the energy up by 93%93\%. The more interesting comparison is between RK4 and the symplectic pair. At this step RK4 wins on the ten-orbit numbers, and a reader who stopped here would conclude that RK4 is the right tool. Stretch the run and look at the angular momentum and energy over more orbits (the same step, 200200 per orbit, from the lab’s functions, checked against an independent Python code):

methodmax energy error at 10 / 100 / 1000 orbitsposition error at 10 / 100 / 1000 orbits
RK49.935e-6 / 9.329e-5 / 9.275e-49.40e-4 / 0.0773 / 1.777
Verlet2.689e-3 at all three0.4291 / 1.949 / 1.160
Yoshida 42.017e-5 at all three3.31e-3 / 3.31e-2 / 0.3257

Read it column by column. The RK4 energy error grows linearly with the number of orbits: ten times the orbits, ten times the error. Verlet’s and Yoshida’s maximum energy error is the same at ten and at a thousand orbits, which is what bounded means. The angular momentum tells the same story: Verlet and Yoshida hold ∣Δh/h∣\lvert\Delta h/h\rvert at about 10−1410^{-14}, rounding level, because angular momentum is conserved exactly by these methods for a central force, while RK4’s drifts (1.4×10−61.4 \times 10^{-6} at ten orbits) and Euler’s changes by 46%46\%.

The position error is where honesty is needed, because it does not stay bounded for any of them. Yoshida’s phase error grows linearly and cleanly: 3.31×10−33.31 \times 10^{-3}, then 3.31×10−23.31 \times 10^{-2}, then 0.3260.326, which is a factor of ten per factor of ten in orbits until it begins to wrap. Verlet’s has already wrapped by 100100 orbits: an error of 1.9491.949 is comparable to the orbit’s diameter, so the spacecraft is somewhere else on the ellipse and the number 1.1601.160 at 10001000 orbits tells us nothing beyond “not where it should be”. RK4’s phase error grows by 8282 times for ten times the orbits and saturates at 1.7771.777 by a thousand orbits. A symplectic method gives you the right ellipse and the wrong place on it, and the wrong place gets worse linearly in time. If you need to know where the spacecraft is after a thousand orbits, you need a small step or a high order, or an analytic propagator, which is the idea of step 5.

Order and cost

How the energy error scales with the step, from 100100 to 800800 steps per orbit (max relative energy error over 1010 orbits at e=0.5e = 0.5):

steps per orbitRK4VerletYoshida 4
1002.986e-41.0845e-23.132e-4
2009.935e-62.689e-32.017e-5
4003.458e-76.710e-41.269e-6
8001.300e-81.677e-47.947e-8

Each row halves the step. Verlet’s error falls by 4.034.03, 4.014.01, 4.004.00: second order, as it should. Yoshida’s falls by 15.515.5, 15.915.9, 16.016.0: fourth order. RK4’s falls by 30.130.1, 28.728.7, 26.626.6, an observed order between 4.74.7 and 4.94.9, which is better than fourth. My explanation, which I derived and did not check anywhere else, is that RK4’s energy error on an oscillator is a dissipation term whose leading coefficient is of order h6h^6 per step, so it is h5h^5 per orbit, and the measured ratios of about 2727 to 3030 are between 24=162^4 = 16 and 25=322^5 = 32. The first thing to note is that this is a property of the energy error and not the order of the method, which is four.

The second thing is cost. Fix a budget of 12001200 force evaluations per orbit (Verlet 12001200 steps, Yoshida 400400, RK4 300300) and run 100100 orbits at e=0.5e = 0.5:

method (steps per orbit)max energy errorposition error at 100 orbits
Verlet (1200)7.451e-50.1225
RK4 (300)1.237e-51.033e-2
Yoshida 4 (400)1.269e-62.083e-3

At equal cost Yoshida wins on both measures here, by a factor of ten in energy over RK4 and a factor of five in position, and the cheap, low-order Verlet loses despite having the best energy behaviour in principle. Over a thousand orbits RK4’s linearly growing error would cross Yoshida’s bounded one by a wide margin, so the ranking would only get more lopsided. For one orbit with a loose tolerance RK4 is fine. For a planner that propagates years of flight, you want a symplectic method of high order.

Now implement the Verlet step and the energy-error measurement yourself.

🧪 Coding exerciseExercise: velocity Verlet and its measured energy error
⌘/Ctrl + Enter

The eccentric orbit

Everything above used e=0.5e = 0.5. The case that breaks fixed steps is a high eccentricity, because the spacecraft moves fast and curves hard near periapsis and slowly elsewhere, and a step fine enough for periapsis wastes work at apoapsis. Take a=1a = 1 and e=0.9e = 0.9, periapsis 0.10.1 (a point-mass test: that is inside the Earth if the unit is the Earth’s radius, and I am using it only to stress the integrator). The orbit is the same energy as before; what changed is that the speed at periapsis is (1+e)/(1−e)=4.36\sqrt{(1 + e)/(1 - e)} = 4.36 in units of the circular speed.

At a fixed Verlet step of 420420 per orbit, the worst relative energy error is 0.61320.6132 at both 1010 and 100100 orbits, so the orbit is wrong by more than half its energy within a couple of revolutions. (At 10001000 orbits the node program gave 0.61410.6141 and the independent numpy program 0.62650.6265: a badly resolved orbit is sensitive to rounding, so I quote only the first two numbers and say “about 0.610.61”.) RK4 at the same 420420 steps does worse: 0.30240.3024 at 1010 orbits and 51.2951.29 at 100100, which means the energy has run away entirely. Refining Verlet helps at the expected second-order rate: 2.405×10−32.405 \times 10^{-3} at 64006400 steps per orbit and 6.012×10−46.012 \times 10^{-4} at 1280012800, for ten orbits. To get a bounded error of 1.5×10−31.5 \times 10^{-3} with a fixed step you need roughly 80008000 steps per orbit (by interpolating those two), and almost all of them are wasted far from periapsis.

The remedy is a step that depends on where the spacecraft is, for example h=η r3/2h = \eta\, r^{3/2}, proportional to the local orbital period scale, which is small at periapsis and large at apoapsis. There is a trap. A symplectic method has its guarantees only for a fixed step. If hh is chosen from the state at the start of the step, the map from one state to the next is no longer symplectic and no longer reversible, and the energy error is no longer bounded. The lab implements both versions (the Verlet stepper with η=0.02\eta = 0.02, from the same periapsis state):

step rulemax energy error at 10 / 100 / 1000 orbitssteps per orbitforce evaluations per orbit
naive: h=η rstart3/2h = \eta\,r_{\text{start}}^{3/2}2.402e-3 / 1.042e-2 / 8.894e-2422 / 416 / 394about 840
time-symmetric1.485e-3 at all three425 / 420 / 419about 3300

The naive rule looks as good as the fixed step at ten orbits (and it is hundreds of times better than the fixed step at about the same number of steps), and then it drifts: 4.34.3 times more error at a hundred orbits and 3737 times at a thousand. The time-symmetric rule is bounded, as promised. It is the rule of Hut, Makino and McMillan (from memory): choose the step so that the step as measured from the end of the step is the same as the step measured from the start, that is 1/h=12(1/(ηgstart)+1/(ηgend))1/h = \tfrac12\left(1/(\eta g_{\text{start}}) + 1/(\eta g_{\text{end}})\right) with g=r3/2g = r^{3/2}, and find hh by a short fixed-point iteration. The step is then a function of both ends, which makes it reversible, and the reversible symmetric scheme keeps the energy bounded again. The honest part is the cost, which I measured: the iteration uses about four times as many force evaluations as the naive rule (33003300 against 840840 per orbit; the two versions of the count agree to four digits and differ in the fifth, so quote “about 33003300”). Even so, it is more than twice as efficient as the fixed step that would be needed for the same energy error (80008000 steps).

Two other remedies exist and I did not build them, so they are from memory. A Sundman transformation changes the independent variable from time to a fictitious time ss with dt=r dsdt = r\,ds so that a fixed step in ss is a variable step in tt, and the Kustaanheimo-Stiefel regularisation goes further and removes the 1/r1/r singularity entirely, which also makes collision orbits integrable. Adaptive RK45 (4.4 Adaptive Step Size & RK45) controls the local error and so handles the step choice automatically, but it is not symplectic and will show the linear energy drift of RK4 for long runs.

Step 3: impulsive maneuvers

An impulsive burn changes the velocity in zero time, so the position is unchanged across it. This is a good model when the burn lasts a small fraction of the orbit, and it is wrong for a low-thrust ion engine (see the limits section). With it, every transfer reduces to vis-viva arithmetic.

Hohmann

To go from a circle of radius 11 to a circle of radius RR in the same plane, Hohmann’s transfer is the ellipse that touches both, with periapsis 11, apoapsis RR and semi-major axis at=(1+R)/2a_t = (1 + R)/2. The first burn is prograde at radius 11, the second prograde at radius RR:

Δv1=2R1+R−1,Δv2=1R−2R(1+R),tflight=πat3/2.\Delta v_1 = \sqrt{\frac{2R}{1 + R}} - 1, \qquad \Delta v_2 = \frac{1}{\sqrt R} - \sqrt{\frac{2}{R(1 + R)}}, \qquad t_{\text{flight}} = \pi a_t^{3/2}.

For R=4R = 4: Δv1=0.2649111\Delta v_1 = 0.2649111, Δv2=0.1837722\Delta v_2 = 0.1837722, total 0.44868330.4486833 of the circular speed, flight time 12.4182412.41824 time units, transfer eccentricity 0.60.6. For the course’s LEO to GEO case, the start radius 67786778 km and the target 4216442164 km (R=6.2208R = 6.2208), the same formulas give 2.397512.39751 and 1.456501.45650 km/s, a total of 3.854013.85401 km/s, in 21.551421.5514 time units, or 5.29125.2912 hours. That agrees with the 3854.013854.01 m/s and 19048.419048.4 s of 12.7 Orbital Mechanics, as it should, since this is the same calculation (the 4216442164 km figure is from memory).

Is the formula right once the spacecraft is flown by an integrator? The check is to fly it. Take R=4R = 4, burn prograde at t=0t = 0, integrate until the radial velocity changes sign (apoapsis), burn again, and look at the resulting orbit. Using Verlet at h=0.01h = 0.01, the second burn fires at the first step boundary after apoapsis at t=12.42t = 12.42, at a radius of 4.0002454.000245, and the final orbit has a=4.000180a = 4.000180 and e=1.10×10−4e = 1.10 \times 10^{-4} (circular is 00), with a maximum energy error of 4.742×10−54.742 \times 10^{-5} and a position error against the exact two-body flight of 4.27×10−44.27 \times 10^{-4}. Reducing the step by ten to 0.0010.001 gives t=12.419t = 12.419, r=4.0000024r = 4.0000024, e=8.97×10−5e = 8.97 \times 10^{-5}, energy error 4.742×10−74.742 \times 10^{-7} and position error 4.28×10−64.28 \times 10^{-6}: the energy and position errors fell by exactly a hundred (second order), while the final eccentricity did not fall at all. The reason is that the burn fires at the step boundary, not at the true apoapsis, so the burn direction and time are off by up to a step, and that small error does not shrink at second order. RK4 at h=0.01h = 0.01 does better on every number: a=4.00000007a = 4.00000007, energy error 2.74×10−102.74 \times 10^{-10}, position error 3.3×10−93.3 \times 10^{-9}, and e=2.09×10−4e = 2.09 \times 10^{-4}, whose residual is again the detection of the apoapsis. The exact answer, from DOP853 and a root-finding on the sign change, is a burn at t=12.418235332t = 12.418235332 and a radius of 4.00000000004.0000000000. The lab uses the step boundary and tells you so.

Bi-elliptic

A bi-elliptic transfer takes three burns: go out on an ellipse to a far apoapsis rbr_b, burn there to raise the periapsis to RR, and burn at RR to circularise. Vis-viva gives each burn, with a1=(1+rb)/2a_1 = (1 + r_b)/2 and a2=(R+rb)/2a_2 = (R + r_b)/2:

Δv1=v(1;a1)−1,Δv2=v(rb;a2)−v(rb;a1),Δv3=∣1R−v(R;a2)∣,v(r;a)=2r−1a.\Delta v_1 = v(1; a_1) - 1,\quad \Delta v_2 = v(r_b; a_2) - v(r_b; a_1),\quad \Delta v_3 = \left\lvert\frac{1}{\sqrt R} - v(R; a_2)\right\rvert, \qquad v(r; a) = \sqrt{\frac2r - \frac1a}.

Why can three burns beat two? Far from the attractor the speed is tiny, so a change of speed there is cheap, and it changes the periapsis a lot. In the limit rb→∞r_b \to \infty the second burn costs nothing, the first is the escape burn 2−1\sqrt2 - 1 and the third is the arrival burn (2−1)/R(\sqrt2 - 1)/\sqrt R, so the total is exactly

Δvbi-elliptic(rb→∞)=(2−1)(1+1R),\Delta v_{\text{bi-elliptic}}(r_b \to \infty) = (\sqrt2 - 1)\left(1 + \frac{1}{\sqrt R}\right),

which falls monotonically with RR and tends to 2−1=0.4142\sqrt2 - 1 = 0.4142, while the Hohmann total tends to 2−1\sqrt2 - 1 from above after peaking near R=15.58R = 15.58 (the maximum of Hohmann’s Δv\Delta v; the numerical optimum is 15.5817154715.58171547 in the node code and 15.5817178215.58171782 in scipy, so I quote 15.58215.582). The two curves cross at one point. Setting them equal and solving by bisection gives the crossover

R∗=11.93876552,R^* = 11.93876552,

and the independent solution with brentq agrees to 10−1610^{-16}. For RR below it Hohmann is cheaper no matter what rbr_b is, and above it a large enough rbr_b wins. The classic quotation is 11.9411.94 (from memory), and the computation gives it. The cell below does both the flying check and the bisection.

🐍 PythonStep 3: fly a Hohmann transfer with Verlet, and bisect for the bi-elliptic crossover
⌘/Ctrl + Enter

The table compares the transfers for a few radius ratios (total Δv\Delta v in units of the start circular speed; flight times in periods of the start orbit, that is units of 2π2\pi time units):

RHohmannHohmann flightbi-elliptic, rb to infinitybi-elliptic, rb = 100rb = 100 flight
100.52978756.4490.54519940.5459369383.38
120.53417998.2860.53378670.5364974388.97
150.536218211.3140.52116300.5265023397.44
200.534731417.0120.50683450.5159265411.81
500.513695864.3840.47279220.4966508504.19

Three features of it are worth saying aloud. First, at R=10R = 10 no bi-elliptic transfer wins: Hohmann is 0.52980.5298 against 0.54520.5452 for the limit and 0.54590.5459 for rb=100r_b = 100. Second, at R=12R = 12, just above R∗R^*, the limit case wins by 0.00040.0004 and a bi-elliptic with rb=100r_b = 100 does not: for R=12R = 12 you need rb≥815.82r_b \ge 815.82 before the three-burn transfer beats Hohmann, and for R=15R = 15 the threshold is rb≥18.19r_b \ge 18.19. Third, the savings are real but small and come with a flight time of hundreds of orbits. At R=20R = 20 with rb=60r_b = 60 the total is 0.52073910.5207391 against Hohmann’s 0.53473140.5347314, a saving of 2.6%2.6\%, and the flight time is 1323.941323.94 time units (210.71210.71 start-orbit periods) against Hohmann’s 106.889106.889. Flying this plan with Verlet at h=0.005h = 0.005 gives burn 2 at t=529.325t = 529.325 and burn 3 at t=1324.345t = 1324.345, with a final eccentricity of 1.085×10−41.085 \times 10^{-4} and a=20.0041a = 20.0041. Whether a 2.6%2.6\% saving is worth a factor of twelve in time depends on what you are carrying; that is a mission decision and not a numerical one.

I did not find the best rbr_b for each RR. A golden-section search for it goes to the boundary of the search range, because the total Δv\Delta v is not unimodal in rbr_b on a wide range (it is worse than Hohmann at the small end for R=10R = 10), so the table gives the limit and the sample rb=100r_b = 100 and the thresholds, which are reliable.

🧪 Coding exerciseExercise: Hohmann and bi-elliptic burns from vis-viva
⌘/Ctrl + Enter

Plane change

To change the orbital plane by an angle Δi\Delta i at the point where the orbits cross, rotate the velocity vector without changing its length. The velocity change has magnitude 2vsin⁡(Δi/2)2v\sin(\Delta i/2), which is proportional to the speed, so the cheapest place to do it is where the speed is lowest: the apoapsis. A 6060 degree change at the circular speed costs exactly 1.01.0 (a full circular speed), since 2sin⁡30∘=12\sin 30^\circ = 1.

For a launch at 28.528.5 degrees latitude (the inclination of the orbit one gets by launching due east from there; the latitude is from memory) into a GEO transfer, the numbers in km/s are these. A pure plane change at LEO speed costs 3.775323.77532; at GEO speed, 1.513681.51368; but if you change the plane at the apogee of the transfer ellipse while burning to circularise, the combined burn is a single vector difference with magnitude v12+v22−2v1v2cos⁡Δi\sqrt{v_1^2 + v_2^2 - 2v_1v_2\cos\Delta i} and costs 1.824071.82407 km/s (the apogee speed is 1.618171.61817 km/s). Circularising first and then changing the plane at GEO speed costs 1.4565+1.51368=2.970181.4565 + 1.51368 = 2.97018 km/s in total, so the combined burn saves 1.151.15 km/s over the separate ones. The point is not the number but the principle: put the plane change in the burn that is already happening, and at the highest altitude.

For a hand version of the same idea at R=4R = 4 and a 3030 degree plane change, see the problems at the end.

Step 4: patched conics, Earth to Mars

A transfer between planets involves three bodies in principle, and the patched-conic approximation reduces it to a chain of two-body problems. The spacecraft follows a hyperbola about Earth until it leaves the Earth’s sphere of influence, then an ellipse about the Sun that takes it to Mars’s orbit, then a hyperbola about Mars. The approximations are: the planets move on circular, coplanar orbits about the Sun; each leg is a pure two-body orbit about one body; and the handoff between legs happens instantaneously at the sphere of influence, with a simple velocity addition. This is a good first design tool and a poor final one: the whole point of the calculation below is to see where it is wrong.

The constants, in km and s: 11 AU =149597870.7= 149597870.7 km, μ⊙=1.32712440018×1011\mu_{\odot} = 1.32712440018 \times 10^{11} km3^3/s2^2, μMars=42828.375\mu_{\text{Mars}} = 42828.375 km3^3/s2^2, Mars’s orbital radius 1.5236791.523679 AU, and a Mars capture orbit of radius 37963796 km (3396.23396.2 km planet radius plus 400400 km altitude). All of those are from memory and I did not look them up, and the quoted results inherit any error in them.

The heliocentric part is a Hohmann transfer between the Earth’s orbit (29.7846929.78469 km/s circular speed) and Mars’s (24.1293924.12939 km/s). The transfer ellipse has at=188768502a_t = 188768502 km. The speed at its perihelion is 32.7293832.72938 km/s and at aphelion 21.4805021.48050 km/s, so the excess speeds are

v∞,dep=2.944689 km/s,v∞,arr=2.648895 km/s.v_{\infty,\text{dep}} = 2.944689\ \text{km/s}, \qquad v_{\infty,\text{arr}} = 2.648895\ \text{km/s}.

The flight time is half the transfer period: 258.8658258.8658 days. Mars moves 360∘×258.8658/686.9714=135.66∘360^\circ \times 258.8658/686.9714 = 135.66^\circ in that time, while the spacecraft sweeps 180∘180^\circ, so at departure Mars must lead the Earth by 44.344244.3442 degrees. Earth and Mars return to the same relative position after a synodic period, 1/(1/365.2569−1/686.9714)=779.9491/(1/365.2569 - 1/686.9714) = 779.949 days, so launch windows are about 2626 months apart. These are closed forms; the cell below computes all of them.

The departure burn from a circular parking orbit. The hyperbola has excess speed v∞v_\infty at infinity, and energy conservation gives the speed at the parking radius rpr_p as v∞2+2μ/rp\sqrt{v_\infty^2 + 2\mu/r_p}, so

Δvdep=v∞2+2μrp−μrp.\Delta v_{\text{dep}} = \sqrt{v_\infty^2 + \frac{2\mu}{r_p}} - \sqrt{\frac{\mu}{r_p}}.

For rp=6778r_p = 6778 km and v∞=2.944689v_\infty = 2.944689 km/s this is 3.5691193.569119 km/s, and the capture burn into the 37963796 km circular orbit about Mars is 2.0799372.079937 km/s.

The patch and where it leaks

Take the departure burn seriously and fly it. The Earth’s sphere of influence has radius rSOI=a(m/M)2/5r_{\text{SOI}} = a(m/M)^{2/5} with aa the planet’s orbital radius (0.40.4 is the usual exponent, from memory), which is 924647924647 km for Earth and 577227577227 km for Mars. The patch: integrate the Earth hyperbola out to rSOIr_{\text{SOI}}, take the exit velocity relative to Earth, add the Earth’s heliocentric velocity, and fly the result about the Sun. The question is what orbit that gives, which the cell below computes analytically with the exit speed from energy conservation and the exit direction from the angular momentum.

With the textbook burn 3.5691193.569119 km/s the spacecraft leaves the sphere of influence after 75.79375.793 hours at a speed of 3.0876143.087614 km/s, not 2.9446892.944689. The heliocentric orbit has perihelion 1.0000781.000078 AU and aphelion 1.5589181.558918 AU, which overshoots Mars’s 1.5236791.523679 AU by 0.0350.035 AU, about 5.35.3 million km. The reason is that v∞v_\infty is the speed at infinite distance, and the spacecraft leaves the Earth’s sphere of influence while it is still deep in the potential: its speed there satisfies vSOI2=v∞2+2μ/rSOIv_{\text{SOI}}^2 = v_\infty^2 + 2\mu/r_{\text{SOI}} and the extra 2μ/rSOI2\mu/r_{\text{SOI}} term is not zero. So the burn computed for infinity gives too much speed at the patch. Correct the burn so the speed at the sphere of influence is v∞v_\infty,

vpark=v∞2+2μrp−2μrSOI,v_{\text{park}} = \sqrt{v_\infty^2 + \frac{2\mu}{r_p} - \frac{2\mu}{r_{\text{SOI}}}},

which gives 3.5306933.530693 km/s, 0.03840.0384 km/s less, and the exit takes 78.96678.966 hours at 2.9446892.944689 km/s. The resulting aphelion is 1.5248181.524818 AU, a miss of 0.00110.0011 AU (170000170000 km) in the radius at which Mars’s orbit is crossed, and the heliocentric flight time to aphelion is 257.154257.154 days against the ideal 258.866258.866. The textbook burn’s own flight time to aphelion was 262.503262.503 days. So the conic patch is good to under a tenth of a percent in aphelion once the burn accounts for the sphere of influence, and to about two percent if it does not. What is still missing in the corrected version is the gravity of the Earth beyond the sphere of influence, the Sun’s pull during the 79 hours of escape, and the finite size of the sphere of influence, which is why the corrected aphelion is not exactly Mars’s radius.

🐍 PythonStep 4: Earth to Mars, closed forms and the sphere-of-influence patch
⌘/Ctrl + Enter
🧪 Coding exerciseExercise: the burns and the lead angle of the Earth to Mars transfer
⌘/Ctrl + Enter

Step 5: Lambert’s problem and shooting

The planner so far has been forward: choose a burn, predict where it ends. The inverse question is the one a mission designer asks. Given the position r1\mathbf r_1 now and the position r2\mathbf r_2 at a time Δt\Delta t later, what velocity at r1\mathbf r_1 gets you there? That is Lambert’s problem, and it is a two-point boundary value problem: the equations of motion with a position specified at each of two times instead of a position and a velocity at one time, the shape of 8.1 Two-Point Boundary Value Problems.

There are two ways to solve it, and they differ in what they assume about the propagator.

Shooting treats it as root finding. Let F(v1)F(\mathbf v_1) be the position reached after time Δt\Delta t from the state (r1,v1)(\mathbf r_1, \mathbf v_1), minus r2\mathbf r_2. Solve F(v1)=0F(\mathbf v_1) = 0 for the two unknowns v1\mathbf v_1 by Newton’s method with a finite-difference Jacobian. Each Newton step costs three flights (one at the current guess, one for each of the two columns of the Jacobian), and the flight can be done by any integrator. That is the strength of shooting: it works for any dynamics, including perturbations that no formula covers. The weakness is that it needs a starting guess in the basin of convergence, and each flight costs a full integration.

The universal-variable solver uses the fact that the two-body problem has an exact solution. The unknown is a single scalar zz (the universal variable, positive for ellipses, negative for hyperbolas and zero for parabolas), and the time of flight is an explicit function of it through the Stumpff functions

C(z)=1−cos⁡zz,S(z)=z−sin⁡zz3/2,C(z) = \frac{1 - \cos\sqrt z}{z}, \qquad S(z) = \frac{\sqrt z - \sin\sqrt z}{z^{3/2}},

and the geometry A=sin⁡θr1r2/(1−cos⁡θ)A = \sin\theta\sqrt{r_1r_2/(1 - \cos\theta)} and y(z)=r1+r2+A (zS−1)/Cy(z) = r_1 + r_2 + A\,(zS - 1)/\sqrt C. The time of flight is F(z)=(y/C)3/2S+AyF(z) = \left(y/C\right)^{3/2}S + A\sqrt y and it is monotonic in zz on the branch we care about, so a bracketed bisection or Newton on zz finds the root with no initial guess. The velocities then come from the Lagrange coefficients, f=1−y/r1f = 1 - y/r_1, g=Ayg = A\sqrt y and g˙=1−y/r2\dot g = 1 - y/r_2: v1=(r2−fr1)/g\mathbf v_1 = (\mathbf r_2 - f\mathbf r_1)/g. This version handles a single revolution counter-clockwise; the multi-revolution and clockwise branches need more care and the lab does not implement them.

Three tests establish that both are right. (i) Fly the state (1,0,0.3,0.9)(1, 0, 0.3, 0.9) for T=1.3T = 1.3: it ends at r2=(0.7360961,0.9587238)\mathbf r_2 = (0.7360961, 0.9587238) with velocity (−0.5813076,0.4655459)(-0.5813076, 0.4655459), a transfer angle of 52.4834∘52.4834^\circ. Hand r1\mathbf r_1, r2\mathbf r_2 and TT to the Lambert solver and it returns v1\mathbf v_1 to about 10−1410^{-14} (1.2×10−161.2 \times 10^{-16} in the node code, 1.1×10−141.1 \times 10^{-14} in Python). (ii) A transfer angle above 180∘180^\circ is harder, because sin⁡θ\sin\theta changes sign: the state (1,0,0,1.2)(1, 0, 0, 1.2) flown for T=10T = 10 sweeps 207.558∘207.558^\circ and is recovered to about 10−1510^{-15} (node) and 5×10−135 \times 10^{-13} (Python). (iii) An independent fsolve shooting with DOP853 as the propagator recovers v1\mathbf v_1 to 10−1510^{-15}.

🐍 PythonStep 5: a universal-variable Lambert solver in numpy, and two round trips
⌘/Ctrl + Enter

Shooting with the exact propagator takes four Newton iterations from the circular-speed guess for the first test, with the miss distance falling as

0.4686222502→0.02925064→1.1451×10−4→2.0176×10−9→rounding.0.4686222502 \to 0.02925064 \to 1.1451 \times 10^{-4} \to 2.0176 \times 10^{-9} \to \text{rounding}.

That is quadratic convergence: each miss is about the square of the previous one, times a constant. (After the fourth step the printed residuals are rounding noise and not worth quoting.) The finite-difference Jacobian cost nothing in convergence order here. And what does the choice of propagator do to the answer? Shooting with an RK4 propagator at step 0.050.05 recovers v1\mathbf v_1 to 3.375×10−83.375 \times 10^{-8}, at step 0.010.01 to 5.04×10−115.04 \times 10^{-11}, and a Verlet propagator at 0.010.01 gives 1.375×10−51.375 \times 10^{-5}; all took four iterations. This is the point to remember: Newton converges to the solution of the discretised problem, so the answer is wrong by exactly what the propagator is wrong by, however fast Newton converges. For a planner, the universal-variable propagator is exact and fast, and the lab uses it as its reference. Shooting is for the problems that have no exact propagator.

Now write the shooting loop with the RK4 propagator provided.

🧪 Coding exerciseExercise: Newton shooting for the launch velocity
⌘/Ctrl + Enter

Rendezvous: when to go

Lambert also answers the rendezvous question: the target is on its own circular orbit and will be at a known place at a known time. For a circular start orbit of radius 11, a target on a circle of radius R=4R = 4, and a target lead angle φ0\varphi_0 at the moment of departure, the total Δv\Delta v (departure plus arrival matching) is a function of the flight time τ\tau. The Hohmann phasing angle is the lead that makes the Hohmann transfer land on the target: φH=91.0609∘\varphi_H = 91.0609^\circ for R=4R = 4. At exactly that lead the best total is 0.44868330.4486833 at τ=12.41823\tau = 12.41823, which is Hohmann itself. If the target is 0.20.2 rad ahead the best total is 0.46287200.4628720 at τ=11.9734\tau = 11.9734 (a faster, slightly costlier transfer), and 0.20.2 rad behind gives 0.46217810.4621781 at τ=13.3457\tau = 13.3457. At an offset of 0.50.5 rad the best total is 0.52867640.5286764 at τ=11.6755\tau = 11.6755, which is 18%18\% more than Hohmann. A launch window is therefore not a point but a flat-bottomed valley in the plane of lead angle and time, whose width is a design choice: waiting for the perfect phasing saves Δv\Delta v, and a cheaper schedule costs it. In the lab’s Lambert mode the diagnostic strip plots this total against the time of flight and marks the minimum.

Step 6: the planner

The sim holds all of this in one place. The big panel shows the orbit in the plane, with the central body at the origin. In maneuver mode, a plan is a list of up to three nodes, each placed at the start, at the next apoapsis or at the next periapsis, with a prograde and a radial component of Δv\Delta v that you set with sliders. The presets fill them in: Hohmann (two nodes from RR), bi-elliptic (three nodes from RR and rbr_b), a circular start or an eccentric one, and a free plan. Turn “fly the plan” on and the lab integrates the whole plan with the integrator you chose, at the step you chose, applying each node at the first step boundary after the event it is tied to. Turn on “osculating orbit” and it draws the instantaneous ellipse, which is what the spacecraft would follow if all burns stopped now. The strip below the orbit plots the energy error and the position error against an exact universal-variable flight from the last burn, on a log scale against time, so you can see the Verlet energy error oscillate and the RK4 error climb. The readout reports the total Δv\Delta v, the elements of the orbit after each burn, and a warning if the integrator has diverged. In Lambert mode you set the radius ratio, the target lead angle and the time of flight, and the lab solves Lambert’s problem and shows the transfer, with the buttons “Hohmann phasing” (set the lead to φH\varphi_H) and “best time of flight” (the minimum of the total over time). The lab also runs Newton shooting with your chosen integrator and reports how far it lands from the Lambert answer. At the Hohmann phasing the transfer angle is 180∘180^\circ, where the shooting Jacobian is nearly singular and the Verlet shooting does not converge (4040 steps, residual 2.62.6 in my run); the lab says so. That is a real limitation of shooting, and the reason Lambert is the lab’s primary method.

Three things to try. First, load the Hohmann preset at R=4R = 4 and compare Verlet at h=0.01h = 0.01 with Euler: the final orbit with Euler is an ellipse, not a circle, and its energy diagnostic climbs from the first step. Second, load the eccentric preset, which starts on the e=0.9e = 0.9 orbit, raise the step until Verlet loses the orbit (at h=0.05h = 0.05 it escapes along a hyperbola in the first revolution), then try Yoshida, and watch the energy error and where it peaks (at periapsis). Third, set the bi-elliptic preset with R=20R = 20 and rb=60r_b = 60 and read off its Δv\Delta v and its flight time, then switch to Hohmann and compare: that is the table from step 3, and you can read the crossover by moving RR to 1111 and 1313.

◆ Interactive The orbit planner: maneuver nodes, trajectory prediction, energy diagnostics, Hohmann and bi-elliptic presets, integrator choice

Loading simulation…

The same lab opened on the eccentric orbit, where the integrator choice matters most:

◆ Interactive An e = 0.9 orbit at h = 0.01: raise the step and compare Verlet, RK4 and Yoshida 4

Loading simulation…

And in Lambert mode, for the rendezvous of step 5:

◆ Interactive Lambert mode: total delta-v against time of flight for a rendezvous at R = 4

Loading simulation…

Honest limits

  • A point mass is not a planet. There are no perturbations: no oblateness (the J2J_2 term, which makes a low orbit’s plane and periapsis rotate by degrees per day, from memory), no atmospheric drag (which dominates below a few hundred kilometres), no solar radiation pressure, no Moon or Sun acting on an Earth orbit. A real LEO to GEO transfer is accurate to perhaps a few percent in Δv\Delta v with this model and no better, and over weeks the plane and the apsides drift away from the predictions. I cannot give a number for that error from anything I ran here.
  • Impulsive means infinitely strong. A real burn takes minutes, during which the spacecraft moves and gravity acts, and the finite-burn loss for a chemical stage is typically a few percent (from memory). A low-thrust engine does not fit this model at all.
  • Patched conics is an approximation of a three-body problem. I measured one consequence: skipping the sphere-of-influence correction in the departure burn misses Mars by 0.0350.035 AU, and with it 0.00110.0011 AU, but neither number says how a real mission fares, because the circular coplanar planets and the instant patch are both wrong. Mars’s orbit has an eccentricity of about 0.0930.093 and an inclination of about 1.851.85 degrees (both from memory), which makes the Δv\Delta v differ from window to window (I did not compute by how much). The trajectory of a real mission is found by a many-body integration that the patched conic only seeds.
  • No third-body effects. Lagrange points, halo orbits, gravity assists and low-energy transfers are three-body phenomena, and the conserved quantities of this lesson do not survive a third body: the LRL vector is not conserved, and neither is the energy of the pair. 7.10 Chaos & the Lorenz System is the right reminder of how fast small differences grow in a chaotic system, and the many-body gravity of 14.7 N-Body Simulation is where chaos shows up in this subject.
  • The lab’s Lambert solver is single revolution and prograde. It does not handle multiple revolutions or retrograde orbits.
  • The time-symmetric step is from memory. The rule I quote is a form of the Hut, Makino and McMillan rule as I remember it. I implemented it as described above and verified that the energy stays bounded, but I did not check it against the paper.
  • The regularised formulations are not built. Sundman time and the Kustaanheimo-Stiefel variables are from memory only.
  • The UI has not been reviewed in a browser by a person. I ran it under a headless browser and viewed screenshots; I did not interact with it for long.

Concept checks

✅ Concept check

What is the total delta-v of the Hohmann transfer from a circular orbit of radius $1$ to one of radius $4$, in units of the start circular speed? ($\mu = 1$)

✅ Concept check

A velocity Verlet step of $h$ gives a maximum energy error of $2.689 \times 10^{-3}$ on the $e = 0.5$ orbit over ten orbits. The step is halved, to $400$ steps per orbit. What is the new maximum energy error, in units of $10^{-4}$?

✅ Concept check

Earth's orbital period is $365.2569$ days and Mars's is $686.9714$ days. What is the interval between launch windows (the synodic period), in days?

✅ Concept check

Why does RK4 show a linearly growing energy error on a long Kepler run while velocity Verlet and Yoshida do not?

✅ Concept checkselect all that apply

Select all that are true of the bi-elliptic transfer between coplanar circles.

✅ Concept check

What is the main advantage of a universal-variable Lambert solver over Newton shooting with a numerical integrator?

Problems

✏️ Pen & paperHohmann by hand, to the vis-viva check●○○

Take circular orbits of radius 11 and 44 with μ=1\mu = 1. (a) Find the semi-major axis of the transfer ellipse and the speeds on it at radius 11 and radius 44. (b) Find the two burns and the flight time. (c) Check the apoapsis speed against angular momentum conservation, rpvp=ravar_pv_p = r_av_a.

Show worked solution

(a) at=(1+4)/2=2.5a_t = (1 + 4)/2 = 2.5. Vis-viva gives vp=2/1−1/2.5=1.6=1.264911v_p = \sqrt{2/1 - 1/2.5} = \sqrt{1.6} = 1.264911 and va=2/4−1/2.5=0.1=0.316228v_a = \sqrt{2/4 - 1/2.5} = \sqrt{0.1} = 0.316228.

(b) The circular speeds are 11 and 1/4=0.51/\sqrt4 = 0.5, so Δv1=1.264911−1=0.264911\Delta v_1 = 1.264911 - 1 = 0.264911 and Δv2=0.5−0.316228=0.183772\Delta v_2 = 0.5 - 0.316228 = 0.183772, total 0.4486830.448683. The flight is half a period: πat3/2=π×3.952847=12.4182\pi a_t^{3/2} = \pi \times 3.952847 = 12.4182.

(c) rpvp=1×1.264911r_pv_p = 1 \times 1.264911 and rava=4×0.316228=1.264911r_av_a = 4 \times 0.316228 = 1.264911. They agree, which is the Kepler second law at the two apsides. The numbers match the ones the flown plan reproduced in step 3 (Verlet at h=0.001h = 0.001 put the final eccentricity at 9×10−59 \times 10^{-5}, the part of the error the burn timing contributes).

✏️ Pen & paperThe bi-elliptic limit in closed form●●○

(a) Show that, as rb→∞r_b \to \infty, the bi-elliptic transfer between circles of radius 11 and RR costs (2−1)(1+1/R)(\sqrt2 - 1)(1 + 1/\sqrt R). (b) Evaluate it at R=15R = 15, 2020 and 5050 and compare with the Hohmann totals 0.53621820.5362182, 0.53473140.5347314 and 0.51369580.5136958. (c) At R=12R = 12 the two totals differ by only 0.00040.0004. Explain why a finite rb=100r_b = 100 does not win there.

Show worked solution

(a) As rb→∞r_b \to \infty both ellipses have apoapsis speed tending to zero, so Δv2→0\Delta v_2 \to 0. The first burn is from the circular speed 11 to the speed on a very long ellipse with periapsis 11, which tends to the parabolic speed 2/1=2\sqrt{2/1} = \sqrt2, so Δv1=2−1\Delta v_1 = \sqrt2 - 1. The third burn is from the speed on the second very long ellipse at radius RR, 2/R\sqrt{2/R}, down to the circular speed 1/R1/\sqrt R: Δv3=2/R−1/R=(2−1)/R\Delta v_3 = \sqrt{2/R} - 1/\sqrt R = (\sqrt2 - 1)/\sqrt R. The sum is the stated formula.

(b) R=15R = 15: 0.414214×1.258199=0.5211630.414214 \times 1.258199 = 0.521163. R=20R = 20: 0.414214×1.223607=0.5068340.414214 \times 1.223607 = 0.506834. R=50R = 50: 0.414214×1.141421=0.4727920.414214 \times 1.141421 = 0.472792. All three are below the Hohmann values, by 0.01510.0151, 0.02790.0279 and 0.04090.0409, and they match the table in step 3.

(c) At R=12R = 12 the limit is 0.53378670.5337867 against Hohmann’s 0.53417990.5341799. A finite rbr_b pays something for not being infinite, and at rb=100r_b = 100 the total is 0.53649740.5364974, which is 0.00270.0027 over the limit and so 0.00230.0023 worse than Hohmann. The saving of 0.00040.0004 is eaten unless rbr_b is at least 815.82815.82.

✏️ Pen & paperA combined plane change and circularisation●●●

At the apoapsis of the R=4R = 4 Hohmann transfer (speed 0.3162280.316228) we want to end on the circular orbit of radius 44 (speed 0.50.5) and also turn the orbit plane by 30∘30^\circ. (a) Find the cost of circularising and changing the plane in one burn. (b) Find the cost of changing the plane first at the transfer’s apoapsis speed and then circularising, and of circularising first and then changing the plane. (c) Which is cheaper, and why?

Show worked solution

(a) The burn is the vector difference of the two velocities, which differ in length and direction by 30∘30^\circ: Δv=v12+v22−2v1v2cos⁡30∘=0.1+0.25−2×0.316228×0.5×0.866025=0.076139=0.275932\Delta v = \sqrt{v_1^2 + v_2^2 - 2v_1v_2\cos30^\circ} = \sqrt{0.1 + 0.25 - 2 \times 0.316228 \times 0.5 \times 0.866025} = \sqrt{0.076139} = 0.275932.

(b) A plane change at speed vv costs 2vsin⁡15∘=0.517638v2v\sin15^\circ = 0.517638v. At the transfer speed that is 0.1636920.163692, and the circularisation is the plain Hohmann Δv2=0.183772\Delta v_2 = 0.183772, a total of 0.3474640.347464. If we circularise first and change plane at the circular speed 0.50.5, the plane change is 0.2588190.258819 and the total is 0.183772+0.258819=0.4425910.183772 + 0.258819 = 0.442591.

(c) The combined burn at 0.27590.2759 is cheapest, and the circularise-first order the most expensive. Changing plane at the slow transfer speed is cheaper than at the circular speed, but doing both in one burn is cheaper than either because the two velocity changes are not along the same direction: the vector sum is shorter than the sum of the lengths, by the triangle inequality, with the saving 0.07150.0715 over the cheaper separate order. This is the reason the real GEO insertion burn is combined with the plane change, as in step 3.

✏️ Pen & paperThe synodic period and the lead angle●●○

(a) Compute the synodic period of Earth and Mars from the two orbital periods 365.2569365.2569 and 686.9714686.9714 days. (b) The Hohmann flight takes 258.8658258.8658 days. Find the lead angle of Mars at departure, in degrees.

Show worked solution

(a) The relative angular rate is 2π(1/365.2569−1/686.9714)2\pi(1/365.2569 - 1/686.9714) per day, so the synodic period is 1/(0.002737850−0.001455672)=1/0.001282178=779.951/(0.002737850 - 0.001455672) = 1/0.001282178 = 779.95 days, about 2.142.14 years.

(b) Mars’s mean motion is 360/686.9714=0.524029360/686.9714 = 0.524029 degrees per day, and in 258.8658258.8658 days it advances 135.656∘135.656^\circ. The spacecraft sweeps 180∘180^\circ in the same time, so Mars must be 180−135.656=44.344∘180 - 135.656 = 44.344^\circ ahead of Earth at departure, which matches the value from the closed forms in step 4.

Where the course ends

This is the last lesson, and it is worth saying what the sixteen modules have and have not given you, without pretending the lab above is a mission-planning tool. The lab is a small, checked model, and the checks are the part of it I would defend.

The capstones each took one thread of the course to the end. 16.1 Capstone: 2D Virtual Wind Tunnel and 16.2 Capstone: 6-DOF Flight Simulator with Autopilot were about fluids and flight as simulation problems, 16.3 Capstone: Reaction–Diffusion Pattern Lab about a nonlinear PDE, 16.4 Capstone: Drum & Membrane Mode Synthesizer about an eigenproblem, and this one about conservation. A pattern in all of them is that the result is only as good as its verification: a simulation passes if it conserves what should be conserved, converges at the order it claims, and agrees with an independent calculation where one exists. The most useful habit the course can leave is that, more than any formula in it.

Looking back at what this particular lesson used: the linear algebra of the first module for the Jacobian and the Newton step; the vector calculus of the second for central forces and conserved quantities; first-order and second-order ODEs for the energy method and the oscillator; the numerical methods module for the order and stability analysis of RK4 and the symplectic methods that carry this lesson; the systems and dynamical-systems module for the idea that a conservative flow keeps phase-space volume; the boundary value problems module for shooting; and the fluid, flight and physics modules for the ties to simulation that the callouts make. The Laplace transform, the Fourier series and the classical PDEs of the middle of the course are the ones this lesson used least, and a planner has no use for them. That is a statement about this application and not about the subject.

What the course did not cover, and what you would need next for orbits in particular: perturbation theory and the averaging methods that give the secular effect of J2J_2 and drag; the circular restricted three-body problem and its Lagrange points; low-thrust trajectory optimisation, which is an optimal control problem and a boundary value problem together; and high-precision ephemerides, where the planets are not on circles. For differential equations in general: stochastic differential equations, delay equations, differential-algebraic equations, bifurcation theory beyond the first examples, finite elements and spectral methods in depth, and turbulence modelling. All are built from the same ideas, with different words, and the lessons you have now are the vocabulary for reading them.

Key Takeaways

  • The Kepler problem in canonical units (μ=1\mu = 1) conserves E=v2/2−1/rE = v^2/2 - 1/r, h=xvy−yvxh = xv_y - yv_x and the LRL vector, with ∥e∥2=1+2Eh2\lVert\mathbf e\rVert^2 = 1 + 2Eh^2. They are the test suite for any integrator: measure the drift.
  • Symplectic methods (Verlet, Yoshida 4) keep the energy error bounded (Yoshida 2.017×10−52.017 \times 10^{-5} at 1010, 100100 and 10001000 orbits, e=0.5e = 0.5, 200200 steps per orbit) while RK4 drifts linearly (9.9×10−69.9 \times 10^{-6} to 9.3×10−49.3 \times 10^{-4}). A bounded energy error is not a bounded position error: the phase error still grows linearly.
  • Measured orders: Verlet error ratio 44 per halving of the step, Yoshida 1616, RK4 about 2727 to 3030. At an equal cost of 12001200 force evaluations per orbit over 100100 orbits, Yoshida 4 had the smallest errors (1.27×10−61.27 \times 10^{-6} in energy).
  • An orbit of e=0.9e = 0.9 breaks a fixed step (0.610.61 energy error for Verlet at 420420 steps per orbit). A state-dependent step h=ηr3/2h = \eta r^{3/2} drifts (8.9×10−28.9 \times 10^{-2} at 10001000 orbits) unless it is made time-symmetric, which bounds it at 1.5×10−31.5 \times 10^{-3} for about four times the evaluations.
  • Vis-viva gives every impulsive burn. Hohmann at R=4R = 4 costs 0.448680.44868 (units of the circular speed) in 12.41812.418 time units; the bi-elliptic transfer beats it only above R∗=11.93876552R^* = 11.93876552, by up to (2−1)(1+1/R)(\sqrt2 - 1)(1 + 1/\sqrt R) in the limit, at a cost of hundreds of orbits of flight time. A plane change costs 2vsin⁡(Δi/2)2v\sin(\Delta i/2), so combine it with an existing burn at the highest altitude.
  • Patched conics for Earth to Mars gives Δvdep=3.569\Delta v_{\text{dep}} = 3.569 km/s from a 67786778 km orbit, a lead angle of 44.34∘44.34^\circ and a window every 779.95779.95 days. The textbook burn ignores the potential at the sphere of influence and misses Mars by 0.0350.035 AU, and 3.5313.531 km/s brings the miss to 0.00110.0011 AU.
  • Lambert’s problem has an exact universal-variable solution with no initial guess (10−1410^{-14} in v1\mathbf v_1); Newton shooting converges quadratically but only to the answer of its propagator (3.4×10−83.4 \times 10^{-8} for RK4 at h=0.05h = 0.05, 1.4×10−51.4 \times 10^{-5} for Verlet at h=0.01h = 0.01).
  • The model has no perturbations, no finite burns and no third bodies, and its patched-conic constants are from memory. It is a planning sketch with verified arithmetic, not a trajectory design tool.
Finished this lesson?

Mark it complete to track your progress (saved in this browser). Reading every section does this for you.