# How could the Hermes crew check the orbit calculations so fast?

The Hermes orbit calculations in The Martian were so complicated that Rich Purnell had to use some servers at the first place to complete them but when they were sent to the Hermes crew they could easily check them on their on-deck computers.

I maybe can relate to the fact that the orbital checking process can be done much faster if you already have the end results in your expense but in that case I have to ask why the orbital calculations did take so long time at the first place. A slingshot orbital maneuver seems to me as a straightforward and basic calculation which should be easily calculable even on a desktop PC.

Is there a basic misconception about the orbital checking process done by the Hermes crew or the orbit calculation done by Rich Purnell in the movie or am I completely wrong about it?

• I thought the delay was due to the speed of the signal, and had nothing to do with the actual calculation. i.e., it took 4 hours for the signal to get to ground control, and 4 hours to get back. I may be wrong, I'd have to re-watch it to be sure. Commented Nov 1, 2016 at 18:42
• There's a whole area of mathematics known as P=NP which revolves around calculations that who's results can be verified very quickly, but there exists no way to find those results other than to try every single possibility. Commented Mar 31, 2017 at 0:06

Purnell had to check the following -

1. Using the Earth as a gravity assist
2. Intercept and take on supplies from a resupply ship
3. Trajectory back to Mars
4. Intercept from Mars using MAV, including launch, trajectory, matching velocity, etc
5. Using Mars as a gravity assist

All his calculations had to include the fuel used, needed and well as the navigational adjustments they'd need to use.

The Hermes needed to calculate -

2. Adjustment to get back onto original Mars gravity-assist trajectory

All the other calculations were already done by Purnell. They already knew how much fuel they needed to get back, they knew all the aspects of the Mars gravity assist. They needed to figure how to deviate and return.

But, yes, it seems like it was a bit fast in figuring that out, but maybe the navigation computers are made to put you onto certain known coordinates, trajectory and velocity from your current status.

• Also note that Purnell had to generate and check a potentially huge number of different orbits, from start to finish. That's why he needed a supercomputer. He's not checking just one orbit. Compared to that, calculating a rendezvous manoeuvre is (relatively) trivial. Commented Jan 12, 2017 at 9:47

# TL;DR

Purnell needed to pick the best orbital trajectory out of a near infinite list of possibilities.

The Hermes only needed to display one orbital trajectory, i.e. the one that Purnell came up with.

You're assuming that Purnell needs the servers to calculate a single orbital trajectory. But that's not correct. He needs to calculate millions (or trillions) of them, in order to decide which would be best.
It is the amount of possibilities that makes Purnell's work take so long, compared to displaying the resulting orbit aboard the Hermes.

Orbital calculations, when simplified, are functionally equivalent to what your GPS does when it finds a route for you.
When you input your destination address, the GPS looks for the best route. This means that it has to check every possible route, compare them, and return with the best route.

This is what Purnell needs to do on the servers. While there is only a finite amount of roads that a GPS needs to consider; an orbital trajectory has near infinite possibilities to check.

As a basic example, if the orbital calculations would need to assess the consequences of making a course correction; they need to evaluate every possible angle to correct course. 1°, 2°, 3°, ... up to 359° (also 0°, for a course correction that only requires them to increase velocity but not turn the ship).

Notice that I am using a single rotation vector. Since space is 3D, you would need at least two rotation vectors to be more accurate, but due to the tendency of the solar system to stay within the same solar plane, I am simplifying this into a 2D example).

For every one of those course corrections, they need to assess the amount of thrust that needs to be provided. Let us, for simplicity's sake, say that the Hermes has 5 different amounts of thrust to provide.

This means that a single course correction (angle + thrust) has 360 * 5 = 1800 possibilities.

And even then, you are not including decimal values!
If you allow for a decimal precision of 0.1 (for both thrust and angle), that turns into 180,000 possibile course corrections. (NASA will obviously use a higher precision than 0.1, but let's stick to this for the sake of example).

And even then, you are not including the timing of the course correction. Doing a course correction a minute later can drastically alter the resulting trajectory of the Hermes.
So again, you need to multiple the amount of possible course corrections with the amount of possible points in time at which you can make the course correction. Assuming that you need to make the course correction in the timespan of an hour to within a minute's precision (again, grossly oversimplifying), that means you have 60 possibilities. 180,000 * 60 = 10,800,000 possible course corrections

AND EVEN THEN, you are only calculating a single course correction! It's not impossible that the Hermes could travel back to Mars using a single course correction; but it's highly unlikely. For a slingshot maneuver alone, you would expect several course corrections: setting yourself up for the slingshot, and correcting course after the slingshot (since no one can set up a slingshot with that level of accuracy, and even then there might be rounding errors due to the ship's steering and nav controls).

Let's say the average amount of course corrections would be 10. I have nothing to base this on, but at least it avoids the wrong assumption that a single course correction is all it takes.
That means we end up with 108 million travel plans.

Purnell needs to accurately calculate every single one of those travel plans, compare them, and select the most viable one.

Keep in mind that I rounded down considerably for every single number in this calculation. The real numbers will be several orders of magnitude larger than my example calculation!
But even using my very limited and simplified calculations, Purnell's servers would have to perform 108 million times more processing than what the Hermes would have needed to do.

And that still doesn't account for the server processing required for the comparison between these calculated trajectories, and the logic needed to iteratively track which ones you need to calculate in order. As a software developer, I can vouch for the fact that the comparing and ordering of lists that have a non-trivial size can very quickly take up a meaningful amount of your total processing power, if not completely bog down your computer if you're not careful.

Try sorting an Excel column with 1,000,000 rows in it, and see how quickly your computer chokes on that.

Or simply open a 13MB text file (13MB = 109 million bits), make some changes to it and save it. To open this file fully, your computer needs to read 109 million ones or zeroes (rounded for simplicity).

Reading a single bit is laughably trivial compared to calculating an entire orbital trajectory. If you open the 13MB file, your computer will have to read about as many bits as Purnell's servers needed to calculate orbital trajectories (again, using my grossly oversimplified example!)

I hope this highlights the need for excessive processing power, which is why Purnell needed to use supercomputers in order to come up with an answer in a relatively short amount of time. On a household computer, those calculation could take years, if not centuries.

To boil down my calculation, the amount of possible trajectories is equal to:

• The number of directions that the ship can rotate towards.
• The number of levels of thrust (including burn time) that the ship can apply
• The number of time slots in which a course correction has a meaningfully different outcome
• The number of course corrections required to reach the destination (this can vary from trajectory to trajectory, you can only use an average to input into this calculation)

Multiply all those numbers (and probably several others that I am forgetting), and you end up with the total amount of possible trajectories, each of which you need to calculate and compare to the others.

• The author actually checked all of the orbital mechanics in a few days on one PC. (Sorry I forget the source.) Somebody else reran the computations in reverse and got the year the story is set in from the alignments required, again on one PC. Commented Apr 16, 2018 at 15:22
• @Joshua Both those people were backtracking the chosen path, which is already known to work. But in-universe, they were checking all possibilities before knowing if they'd work. There's a huge difference between the two. Furthermore, you'd also expect a real life billion dollar project to be quadruplechecked in excruciating detail, all of which impacts CPU time immensely. Commented Apr 16, 2018 at 16:46
• I strongly doubt that you would check every trajectory. If you fix which gravity assists you are using you only need to find the optimal solution, which you can do with approaches such as newtons method. So you really only need to brute force the gravity assists you want to use. Commented Apr 17, 2018 at 10:58
• @Taemyr: You're assuming that there was a ballpark estimate available before they were crunching the numbers. But in context, Purnell was looking for highly unlikely scenarios as well, it was a last resort. He was looking for anything that would work. Things always seem easier in hindsight, since we omit the cases that now look like "obviously" not the right choice. Commented Apr 17, 2018 at 11:03
• @Flater No. I am saying that you only brute force over overall trajectory. (what gravity assists you want to use, and i suppose the number of course corrections you apply). The rest, attitude, thrust level and length, time when you perform the burn, feeds into a function that gives you the delta-v requirement. You then optimize that using known numerical methods. Commented Apr 17, 2018 at 13:38