10 November 2011

Binary numbers and today and tomorrow's date

You know of course about the binary number system.  With computers being as common as pig tracks these days, everybody has heard that digital computers use binary numbers.  Not many people know that there are also analog computers, which perform mathematical operations such as differentiation and integration using "op amps" or operational amplifiers.  The first integrated circuits (chips) were op amps that combined many transistors in one package.  Who can forget the famous 741 op amp

Anyway, binary numbers were and are interesting in their own right, never mind computers.  Except I do remember when the first home computer was announced, in January 1975 in Popular Electronics (I had a subscription), and I was quite perplexed by what it was supposed to do.  It was a rectangular box that had several rows of single LEDs that displayed binary numbers in a simple on/off fashion.  Commands were entered as binary numbers using a row of switches.  That was it.  With external relays and such, you could turn on and off your house lights, for example.  Whoowee!  But it had an off-the-shelf microprocessor, the Intel 8008, so it was a microcomputer.  Popular Electronics gave the list of parts and instructions on how to build it.

It was useless as a calculator, but if you knew enough and could find the parts you could make it into  a bulky boxy desktop calculator.  Only high-dollar buyers of computers--university computer centers and large companies-- had CRT computer screens and the requisite equipment to make them usable. If you were taking a computer programming class, Fortran or Cobol or assembly language, you used punched cards to run your program, and you got the results on a large green-and-white paper printout.

Handheld calculators, however, had just a couple of years earlier become affordable for students. I had one my father bought me for the first physics class I took in the summer of '74.  It cost in the neighborhood of $100, a Texas Instruments scientific type.  I thus got interested in physics about the time slide rules were going out of fashion and were being replaced by calculators.  I never had to use a slide rule, and I don't remember seeing anyone carrying one around on his belt.  I did buy one at Hendrix College in 1978--actually the bookstore manager gave it to me, since no one was buying them by that time--and I learned the basics of how to use it.

But back to binary numbers.  The 17th century scientist-mathematician-philosopher Gottfried Liebniz called binary numbers the language of God.  This is because so many things in nature do take a dual or binary form, such as male-female, positive-negative, yin- yang, dark-light, love-hate, to-be-or-not-to-be.  Binary numbers, or base-2 numbers, are nowadays expressed in the symbols 1 and 0.  This is all you need for a number system: an incremental unit and identity element, and a "zero" as a placeholder and null element. 

When you write a number in normal decimal notation, you write it in descending powers of ten.  So 468 is 4 x 10-to-the-second-power + 6 x 10-to-the-first-power + 8 x 10-to-the zero-power.   And of course there are ten numerals or symbols in the base ten system, 0 thru 9.

So, today's and tomorrow's dates look like binary numbers (ignoring the backslashes or dashes you have to use to actually write the date, and of course with 2011 abbreviated to 11). An interesting (to me) exercise is to compute what decimal number these numbers, 111011 and 111111 (written in the American and not the European order), would represent if they were binary numbers:


111011  =  1x25 + 1x24 + 1x23 + 0x22 + 1x2 + 1x1  =  32 + 16 + 8 + 0 + 2 + 1  =  59.  Since the 1 in 111111 replaces the zero placeholder at the 22 position of 111011, we just have to add 4 to 59 to get the decimal equivalent of 111111, which is 63.
A harder and even more pointless exercise is to consider the numbers to be decimal (111,011 and 111,111) and to compute their binary equivalents (maybe your calculator can do it).
As a final useless activity, here's the base 16 representation of the binary numbers 111011 and 111111.  Base 16 (hexadecimal) needs 6 more characters than base 10, and A, B, C, D, E, F are the universal choice.  Here's the binary to hex conversion:
0000=0, 0001=1, 0010=2, 0011=3, 0100=4, 0101=5, 0110=6, 0111=7, 1000=8, 1001=9, 1010=10, 1011=A, 1100=B, 1100=C, 1101=D, 1110=E, and 1111=F.
Our binary dates written as hexadecimal numbers are 11 1011 = 3A, and 11 1111 = 3F. (You group the binary digits (bits) into groups of four bits each to express them as hex numbers. I left out the two zeros to the left of the ones in writing 11, see?)
Now when you get some error message like this (I hope you don't) ....
"A fatal exception OE has occurred at 0167:BFF99B3B. The current application will be terminated.
*Press any key to terminate the current application.
*Press Ctrl+Alt+DEL to restart your computer.
You will lose any unsaved information in all applications. Press any key to continue."
....(in other words "press any key and you're still 1111 U 1100 K 1110 1101") you know why there are the Bs and Fs in there--it's a binary number expressed in hexadecimal notation.
Happy Armistice Day, eleven eleven eleven!