Tag Archives: Movies

The Martian

Could LaTeX have saved "The Martian?"

In the 2015 sci-fi movie, The Martian, Mark Watney (Matt Damon) finds himself in the unenviable position of being stranded on Mars. One of the biggest problem our interpid astronaut faces, besides growing his own food to survive, is communicating with NASA. Mark needs to have complex astrophysical engineering conversations with nothing but still-frame camera from the late-90s. Luckily, the camera on the Mars Pathfinder spins. Mark can use degrees of arc to create an alphabet to encode transmissions, which will allow NASA to communicate with him.

The Martian ASCII Table

Mark finds an ASCII table on Beth Johanssen's (Kate Mara) laptop

There are 26 letters in the English alphabet which means each letter will be separated by a little under 14 degrees of arc. This will make it difficult for Mark to know exactly where NASA is pointing the camera. Mark needs to find a way to encode the data to make this task easier. One way of encoding this data is by using the American Standard Code for Information Interchange or ASCII; one of the widely used methods to represent text in computers. For this, Mark needs an ASCII table to translate the camera position into a usable alphabet. Luckily, he finds one on Beth Johanssen's (Kate Mara) laptop.

If Mark had LaTeX on his laptop, he won't need to rummage through his crewmate's personal belongings. With a simple command, he could pull up a PDF of an ASCII chart with ease. We know that much of the science portrayed on film and written in the book is realistic; the physics behind the radioisotope thermoelectric generator (RTG) can be seen in this Science vs. Hollywood article. This raises the question, could a LaTeX installation have saved mark Watney?

The ASCII wall chart

The ASCII wall chart is included in both MikTeX and TeX Live. This table was coded in TeX by Victor Eijkhout and appears to be based on a table seen in a 1972 printer manual. Eijkhout's version goes further as it includes the decimal, octal, and hexadecimal codes for all the ASCII characters.

The Martian ASCII Chart

The LaTeX ASCII Chart

Pulling up the chart is pretty simple. You just type the command:

texdoc --view ascii

in a command prompt or terminal and the chart will appear in your PDF viewer. Much easier than having to rummage through someone's junk.

How it works

As Mark mentions in the movie, he needs an alphabet to communicate with NASA. To transmit data, we need to encode it somehow. One way is to translate the direction Pathfinder's camera to represent a character. There are 26 letters in the alphabet, which means that each character will be separated by 13.8 degrees of arc. This is small and Mark could never be sure which letter the camera is pointing with certainty. To solve this problem, he turns to hexadecimals.

The hexadecimal number system uses sixteen distinct symbols, usually 0-9 and A-F, to represent numbers. If we include a question mark, we have seventeen characters in total. This leaves us with over 20 degrees of arc to work with. This is large enough for Mark to have a better idea which sign the camera is pointing at. Each ASCII character is made up of two hexadecimal digits; the camera has to point to two characters to encode one letter.

This begs the question, why include the question mark? There is an ASCII code (3F) for the question mark. The camera could point first at 3 and then F. Having fewer characters allows the letter signs to be spaced out more and make it easier to determine where the camera is pointing. It turns out that the difference in separation between 16 and 17 characters is not that much. In fact, it is less than two degrees - with 17 characters, the separation is approximately 21.2 degrees of arc but with 16 it is 22.5 degrees.

If we assume that NASA will ask lots of questions, the question mark symbol serves as an end of transmission character. Instead of pointing first at one character and then spinnning to point at another, the camera just points to one. This reduces the time to transmit that character. The time it takes for the camera to spin and point at these two characters is not worth the extra two degrees of arc.

Encoding Data to Communicate

The Martian Bandwidth

Tim Grimes (Nick Mohammed) notices that there is going to be a bandwidth problem on "The Martian."

It's not difficult to see that, while Mark's method of communication is ingenious, it is not without problems. As Tim Grimes (Nick Mohammed) points out, with a signal round trip of a little over thirty minutes and given the speed at which the camera rotates, this will be a very slow method of communication; the data transmission rate is pretty low.

The Martian Hacking Pathfinder

Mark modifies Pathfinder, entering the 20 pieces of hex code needed to patch Pathfinder into his Rover.

To solve this problem, NASA shows Mark how to hack Pathfinder's code so they can communicate by text message. This isn't too different from using Pathfinder's camera to decode a transmission. NASA will still use ASCII to encode a transmission but instead of encoding information as degrees of arc, they can send this information digitally, as a set of ones and zeroes. The computer on Mark's rover can then translate the digital transmission into readable text.

What can we learn from This?

The Martian LaTeX

Mark poses for a picture on "The Martian."

If you find yourself in the unenviable position of being stranded on Mars, a little foresight and planning helps. Make sure LaTeX is always installed on your NASA-issued laptop, as well as your personal machine. Admittedly, LaTeX won't have saved Mark Watney as the information he sought was hidden away on someone else's laptop, it would have made finding the ASCII table easier. But why won't you install LaTeX? It's awesome. Everyone should have it installed. Mark is a pretty resourceful guy. If he can make use of a radioisotope thermoelectric generator to save his life, he could have easily figured out how to use LaTeX.