Monday, July 23, 2012

Talking Basically About Bases

You may or may not know that we operate in a base-10 number system, which is a beautiful thing. It spares us from the agony of Roman numerals, where years looked something like this:

MCMLXXXVIII

Instead of like this:

1988

Remember all that talk about place value in elementary school? Ones, tens, hundreds, thousands, and so on? That's the base-10 idea. Multiply 10 by itself successively, and you get the next place value.

Ten isn't the only number to base a system on, though. Convenient with our ten-fingered anatomy, but it's not even the only base we use on a regular basis. Time notoriously operates on non-ten bases. (Makes figuring elapsed time tricky for some students.) And since this particular country refuses to go metric, most of our measurements avoid the ease of base-10.

There are plenty of practical applications for other bases, but when I first learned about them in school, I remember just thinking it was cool to write a number that meant something other than what it looked like. Sort of a mathematical code.

For example, take base-8. We have to reassign all the place values. The ones place is still the ones place. The next place to the left is now the eights place. And the next is the eight-squareds (or sixty-fours) place, followed by the eight-cubeds (or five-hundred-twelves) place. So earlier I mentioned the year 1988. In base-8, that'd be

3 five-hundred-twelves
7 sixty-fours
0 eights
4 ones

So the year 1988 converts to 3704.

If someone gave me a worksheet of numbers to convert to different bases right now, I'd probably be a happy camper working through it.

And that concludes our Yes-I-Am-A-Geek moment for this week.

1 comment:

Mike Lewis said...

Different bases is explicitly addressed in computer science. We need to know base 8 (octal) and base 16 (hexadecimal) and base 2 (binary). I wrote a script recently that would take a date code (2012-07-23) convert it to a Unix time stamp (number of seconds elapsed since Jan. 1, 1970, in this case 1343032200 as of 8:30 MDT) and then convert that to a base 36 number... lessee... what has 36 unique glyphs in a set? Well, I can use numbers 0 through 9 as well as the alphabet A through Z. This end up producing a very short code I believe only four characters long, and completely understandable only to a script that can decode it.

Yes, measuring the amount of elapsed time between two dates can be tricky, because time is measured across different bases (365 days in a year; 12 months in a year; 28, 29, 30 or 31 days in a month, depending on the circumstance; 24 hours in a day, 60 minutes in an hour, and 60 seconds in a minute.) Additionally, you could be off by an hour if your two dates are on either side of a change for Daylight Savings time... you could be off by an hour.

Makes you wonder what our calendars would look like if they were completely base 10 metric.