# The Martian: Does it really take a supercomputer to calculate spaceflight maneuvers?

My preemptive apologies for asking a question about a movie, and the spoilers within said question, but considering the widespread support for its scientific plausibility, I'm hoping you'll let it slide :)

In the movie The Martian, the character Rich Purnell is shown using the Pleiades supercomputer at the NASA Ames Research Center to confirm the calculations for his maneuver designed to safely redirect the Hermes spacecraft back to Mars, and then to Earth. Why?

Space is just about the most ideal place possible for predictable physics. Little in the way of air or external forces, short of gravity which can be calculated between the spacecraft and the Sun and planets and little else, centrifugal force only during the maneuver itself, almost none of the fluid mechanics that otherwise make simple calculations complicated... Basically, with so few moving parts and sources of complexity, does it really take a 250,000-core supercomputer to run those calculations, or could Rich use, say, his Macbook instead?

• If this were the case (supercomputers required), the Apollo project would have been in big trouble. – Organic Marble Sep 18 '17 at 15:04
• If you go with impulsive burns and non-optimal trajectory, you don't even need a computer - or a notepad. With some training you'd be capable to eyeball semi-correct trajectories that could work with a couple corrective maneuvers. – SF. Sep 18 '17 at 15:19
• To use a 250,000-core supercomputer effectively, you need a problem than may be split in a lot of parallel tasks. But for stepwise calculation of a trajectory you cant calculate the next step before the results of this step are ready. The supercomputer may be used to calculate many variants of the trajectory in the same time. But do you really need 250,000 variants if no swing.by maneuvers are used? – Uwe Sep 18 '17 at 16:51
• Modeling a continuous but low thrust trajectory is harder than conventional trajectories using impulsive burns. But an ordinary computer can do it. The movie's backstory and trailer were not scientifically plausible. They had Hermes departing from LEO and arriving in Mars orbit 124 days later. Which isn't possible given Hermes' 2 mm/s^2 acceleration. – HopDavid Sep 18 '17 at 19:03
• Not only the Apollo project would have been in trouble but also the Voyager missions. The grand tour to many planets required a complex trajectory. – Uwe Sep 19 '17 at 17:32

Well, developing low-thrust trajectories does take more computation than impulsive trajectories (e.g. like Voyager, which was done with rather primitive computers). You have no choice but to run many fully integrated trajectories. However it would not take a supercomputer of the future, or even a supercomputer of the present to search for and find trajectories like that.

In fact, Andy Weir used his home computer (whatever that was, but likely not even a small cluster) to find and check his trajectories. You can find his code here, and there is also publicly available NASA code you can use to propagate trajectories to try this yourself.

• You'll still want to utilize the supercomputer if you want extra benefits besides "getting there" - e.g. Rosetta trajectory just to encounter 67p on Sun-approaching segment of orbit would be simple enough - but instead, it involved four gravity assists and two asteroid fly-bys extra, on top of the comet encounter. This is not really something doable with a pen and paper or on home computers. – SF. Sep 18 '17 at 15:26
• Such trajectories are easily calculable on a home computer, or a smart phone for that matter. Where the supercomputer helps is in searching across many such trajectories. Sometimes a brute force search with powerful supercomputers is cheaper than trying to do something smarter, simply because the computer time is cheaper than the analyst time. However I'm sure that the Rosetta trajectory could have been found with 70's computer technology and smart people. – Mark Adler Sep 18 '17 at 15:33
• I'm not an expert on the story, but there was some urgency to getting the Hermes to Mars and to rescue Matt Damon as he escaped the surface of Mars with the aerodynamically compromised constraints of the stripped-down MAV. This could have put a strain on the electric propulsion system of Hermes to adjust it's trajectory which may have needed some plasma modeling, the MAV's ability to fly stably in Mars' thin atmosphere with holes in it and to reach the correct rendez-vous with Hermes may have also been computationally interesting. – uhoh Sep 18 '17 at 16:11
• Putting margins and contingencies on all of those issues, it may have been more than $\mathbf{a}=\mathbf{F}/m$ that needed the supercomputer. By the way, great links!! – uhoh Sep 18 '17 at 16:12

Calculating an energy-optimal orbit for a simple thing like Earth->Mars is no big deal. Even using low-thrust engines doesn't add much to it. It would be tedious but you could do it on a calculator.

However, that's not what they needed in the book & movie. The objective wasn't to get there as cheap as possible, the objective was to get there as fast as possible given the available energy. There's no standard solution for this, you're simply going to have to try a huge range of possible orbits and see what's best. That's why you want a supercomputer.

Modern deep space craft often use paths that take some pretty extreme calculating. Consider Messenger: 6 planetary encounters and 5 deep space burns. They obviously simulated a huge number of possible paths to find the one that got them there the cheapest.

You-Tube video of the path

• But for an Earth to Mars orbit no planetary encounters are to be calculated. But what about using a non optimal constellation of Earth and Mars to avoid longer waiting for a good constellation? Not to get there as fast as possible but as early as possible? – Uwe Sep 26 '17 at 14:50
• @Uwe That's what I meant. The objective was the earliest landing on Mars given the available delta-v. AFIAK there's no standard equation for that, you simply have to simulate a large number of possibilities and see what you get. A life is on the line, you're not going to simply converge on the "best" answer because you could be stuck in a local optima. – Loren Pechtel Sep 27 '17 at 16:04

The short answer is no, the calculations do not require a supercomputer. Any modern laptop has the computing power to handle the scenario.

The long answer is that the particular orbit depicted in the movie is what's called a Planetary Cycler, which cycles between two bodies (Earth/Mars). You can use gravity assists at each body to put your spacecraft on a return trajectory to the other body. These gravity assists can be augmented with maneuvers as needed.

Here is a PhD dissertation on Planetary Cyclers where an optimization routine was developed to find cyclers for Earth/Mars in the real solar system, without any simplifying assumptions. While the dissertation doesn't discuss computational load, it was done on a single machine.

More generally, things like low-thrust maneuvers or trajectory optimization do increase the computational burden, and for certain applications compute clusters are used, but usually not required. The usual approach is to do a wide search for viable trajectories with a simplified (low computational cost) model, and then when a smaller viable set has been found, apply higher-fidelity models that have a higher computational cost. In this way you can avoid the need to use a supercomputer.

• +1, but Ryan's thesis only dealt with impulsive maneuvers, so the methods therein do not apply to low-thrust trajectories, and the computational load is not representative of a low-thrust search. Such impulsive return trajectories could only be used as an extremely rough starting point for searching for low-thrust returns. The general point is correct however, which is that this is not a computationally intensive problem with respect to modern computers, and there are smart ways to reduce the computational cost for large searches. – Mark Adler Sep 19 '17 at 21:36

I think the answer is probably no, but not for the reasons other answers give. First of all we can ignore the whole multi-body problem: it's a really good approximation that the planets & Sun run on rails since they are hugely more massive than the spacecraft. let's also assume that modelling a trajectory between two points is tractable, whether or not you use continuous thrust or not (this could well be a reasonably hard optimisation problem to minimise fuel &c but I suspect that's very doable on a modern personal computer.

That's not what makes it hard: what makes it hard is that this is a search problem merely dressed up as a physics problem, and search problems, famously, have combinatorial explosions. Search problems require machines like Deep Blue to solve them, and these things are definitely supercomputers (albeit specialised ones).

Why is is a search problem? Well, because the way you get around the Solar System isn't in fact by computing a trajectory between two points, it's by computing a bunch of gravitational slingshots around other bodies in the Solar System. And there are a large number of such possible trajectories, and the number increases, possibly exponentially, as you increase the number of slingshots. And you can't deform the trajectories into each other to use any nice numerical solving approach because you keep crashing into planets since all these trajectories go rather close to planets.

Checking a proposed trajectory is much easier: if I tell you the plan is to do a couple of assists around Venus, a course correction burn in deep space then an assist around Earth and one around Jupiter on the way to Saturn (this is what Cassini did) then you can pretty easily check the trajectory is OK and compute its fine details. But arriving at such a trajectory is a different question. This smells strongly of P and NP: given a solution it is easy to check, but arriving at a solution might be hard.

So this might actually be a computationally seriously demanding problem. I think it probably isn't in fact, for a few reasons: there aren't very many objects you can use for slingshots so the search space doesn't explode too badly, and the mission duration is constrained as is fuel for course adjustments &c so you can prune solutions which take more time than you have or may need more fuel than you have. I suspect that keeps the computation sane.

[Note I'm posting this answer as a guest: I started writing it on the physics SE last night but the question got migrated & I don't belong to this SE.]

• The original trajectory only involves two gravity assists, one each around Mars and Earth, and they're known from the beginning. That should, in theory, eliminate the search aspect – TheEnvironmentalist Sep 19 '17 at 16:48
• Deep Blue is definitely not a supercomputer by today's standards; it was measured at 11.38 GFLOPS, and for \$1000 the Intel Core i9 7900X offers 638.9 GFLOPS. One could fuss about the measurement details, but computers are much faster today than in Deep Blue's day. – prosfilaes Feb 12 '18 at 4:25
• Also, many NP problems are mostly theoretical; you can find a nearly optimal solution to a Travelling Salesman Problem pretty easily, it's finding a proof of optimality that's hard. With smart algorithms, you could find a very good solution pretty easily, even if an optimal solution (or a proof that the solution you have is optimal) might be out of reach. – prosfilaes Feb 12 '18 at 4:29

No. You do not need a supercomputer. But in the movie it would not look so impressive. Iron Sky seems to be more realistic in this case. :-) And yet - very impressive. (spoiler)

The answer can be yes and no, it really depends on what degree of accuracy or how much resolution you want in your simulated data. You can always reduce the floating points or use averaged terms or reduce the upper limit of some loop that tests convergence.

You can simulate something on your home PC or a supercomputer in sufficient times given you don't use extensive recursive methods or switch to more efficient iterative methods or what not.

Again it's about the kind of math that you employ for the task, not the task itself that would require a super computer.

When it comes to maneuvering in space I suppose you do need super computer. Consider this: when rocket is lunched, as it leaves the atmosphere Earth is not the only massive object influencing the motion of the rocket, it is true that effect of Sun or other planets are not as big as Earth's but as rocket goes further we can say that it is influenced by more than 1 or two moving massive objects in space and we face sort of three-body problem (https://en.wikipedia.org/wiki/Three-body_problem). And in Martian they were not simply launching a rocket, they were "slingshooting" it back to Mars and trajectory needed to be calculated precisely as Earth and Mars were moving themselves around Sun and changing their coordinates as well. This is not the case where you simply write Newton's second law and and use Matlab for other calculations, here you will have many variables that will definitely need huge computing power...

• You're strongly overestimating the difficulty of the core problem. The planets are 'on rails' with fixed and known trajectories; the problem is a single-body ODE with known forces, and that can be integrated numerically quite easily. Now, you might need more resources to be extra accurate, or to optimise the trajectory over a range of burn parameters, but the core problem is solvable enough. – E.P. Sep 18 '17 at 8:36