Monday, August 19, 2019

A Good Movie Despite the Math

The camera sends a message. (Image from Medium)
One of my favorite movies of recent years is The Martian, the story of an astronaut who must survive on Mars for a year and a half with only a fraction of the food needed for survival.

A key plot point is how he and NASA can communicate armed only with a still camera that can rotate 360 degrees.

The astronaut can write brief messages to Earth on poster board, but how can Earth send messages to him? The answer: a circle with 16 positions corresponding to hexadecimals:
This is where hexadecimal or base 16 comes in. If we allow ourselves 16 number symbols, then our place values can multiply by 16 at each step. For example, the number 321 represents one unit, two 16s and three 256s, so it is the same as the decimal number 801.

The trouble is that hexadecimal requires 16 symbols, and our usual numerals only go from 0 to 9. The solution is usually to use the letters A, B, C, D, E and F for the extra symbols representing the decimal numbers 10 to 15.

This means that hexadecimal numbers can look like C9F, which represents F (i.e., 15) units, nine 16s and C (i.e., 12) 256s—that is, 3,231. In coding, for instance, colors can be represented as six-character strings in hexadecimal, which yields a total of more than 16 million possible colors, starting at 000000 for pure black and running through FFFFFF for pure white.
In hexadecimals, i.e., base-16, only two characters, FF, are necessary to count up to 255 (in our decimal system). 255 places are more than we need to translate hexadecimals into the standard letters, numbers, symbols, and control characters of the ASCII table.

More than 50 years after converting base-10 numbers into base-2, base-8, and base-12 (by hand, without calculator or computer, kids), I finally see why the teachers made us do it.

(From LookupTables.com)

No comments: