Understanding Slingshots
A rocket can change its velocity and direction by using the gravity well of a planet or star to achieve a slingshot boost. This lesson shows you how that works, then uses the pint library to calculate velocities and times using values with associated units.
00:00 In the previous lesson, I gave an overview of the course. In this lesson, I’ll show you how to do calculations that include units using gravity assist slingshots as an example. A gravity assist, sometimes known as a slingshot maneuver, is one where a spacecraft uses the gravity of a planet or a sun, pretty much anything big, to alter its path and or velocity.
00:23
Consider a planet traveling along at the rate U
.
00:26
When a spacecraft comes in on velocity v
,
00:30 if it goes all the way around the planet, it comes out the other side getting a boost of two times the velocity of the planet.
00:39 Now, this is an oversimplification and there are a lot of other variables in the real calculation, but for our purposes, it’s good enough. In case you’re a physics geek—and who isn’t?—and you’re wondering where this free energy comes from well, it isn’t free.
00:55 The spacecraft is stealing some of the planet’s momentum, but because the mass of the planet so overwhelms the mass of the spacecraft, you’ll never see the effect on the planet.
01:05 No such thing as a free lunch in space or otherwise. You ever had space ice cream? It’s actually not too bad. When doing velocity calculations or pretty much any other kind of physics math, the units associated are very important. Incorrectly converting between units or doing operations on units that aren’t compatible can be a profound source of error.
01:28 In fact, this was what was determined to be the cause of the Mars Climate Orbiter’s failure on planet entry. The program it was running was expecting force expressed in Newton seconds while the data was entered in Imperial units of pound seconds.
01:43 The end result was that the Mars Climate Orbiter landed on Mars. There are two problems with that. One, it wasn’t supposed to, hence, the name orbiter, and two, it was in far more pieces when it got there than when it started.
01:57 So short version, units are important okay? If you’re coding, what can you do about that? Well, the Pint library allows you to code quantities that have unit information attached.
02:08 By doing so, you can convert between units, and if you try to do math between quantities with incompatible units, it throws an exception.
02:16
Pint is a third-party library, which can be fetched using the usual pip install
. Note that there is also a library called Pints with an S. That one is a framework for dealing with Bayesian inference on ODE models of noisy time series data.
02:31 It sure sounds like fun in its own right, it’s just not the one you’re looking for. Let’s head into the REPL and use the Pint library to do some gravity assist calculations.
Become a Member to join the conversation.
Christopher Trudeau RP Team on Sept. 12, 2024
Just leaving this here....
xkcd.com/2981/