Monday, May 11, 2015

Binary numbers...and others





Numbers, Regular, Binary and otherwise…


"The purpose of computing is insight, not numbers."
-Richard Hamming

I love reading about the history of mathematics. I hated doing math homework in grade school. In books on mathematical history you can usually find a blend of social and cultural history, math of course, physics, language and linguistics, and just all sorts of stuff.

One thing I do is mix numbers (1, 2, 3) and the words for those numbers (one, two, three) in my writing. I do this for clarity, although it drives a lot of people nuts. I do it to make the paragraphs look more like sentences and not scary math equations. I had a teacher that made us pick one way for paper: either type the number or write the name of the number throughout our entire essay. Well, in the immortal words of Bartleby, the Scrivener, "I'd prefer not to!"


...and on to the number systems...

The Hebrew numbering systems used 22 or sometimes 27 letters to stand for numbers, with no symbol for zero (Aleph, Bet, Gimel, etc). The Greeks had decimal numbers based on 10—but still written with letters (Alpha, Beta, Gamma, etc). Egyptians had zero, but used hieroglyphs for their numbers.

The Romans of course had their famous letter system (I, II, III, IV, etc).   They had no zero though. Yes, X stood for ‘10’ but they probably thought of it as two Vs piled on each other: five on top of five; not a ‘10’ being comprised of a one and a zero—their higher numbers carried this on because a lack of zero. But, and that’s a big but, since they set up their system based on ten (X) Roman numerals are considered to be base-10 decimal numbers. Today you can find wristwatches and clocks still using Roman Numerals.

Not only did India have zero, they had a binary mathematical system similar to Morse code and the present-day binary system computers use. Dots and dashes. Ones and zeros. Smooth or pitted hole (used by DVD and CD players). Sometimes the Indians used a symbol for zero and sometimes they left a nice space for it in their calculations, but they (and a few other cultures) recognized it just the same—and eventually treated it like any other number;  like we do today.

Eventually the base-10 numbering system we know and love today (0, 1, 2, 3, etc) came into being in what we refer to as Arabic Numerals. Although many of the ‘Arabs’ (Persians) that made it popular called it the Indian Number system—and because it wasn't binary and had a zero it was arguably better than the previously mentioned systems. Although that can be like saying "English is easier than Chinese" because that's what you may be used to.

On expensive custom watches you are sometimes given a choice of whether you want Roman numerals of ‘Arabs’.  Meaning, “do you want 1, 2, 3, etc. to be on your watch or I, IV, X, XII, etc? But that’s not the whole story:



Kisai is a wild watch manufacturer that creates watches in binary—and a bunch of other varied number system schemes. Now when someone asks you the time you can say, “I honestly don’t know—let me do some calculations and get back to you!” They’re cool looking and very thought-provoking, and give just a sample of how different ways to look at ‘numbers’ can exist in just a simple application like a wristwatch.

So, the Arab/Indian Base-10 numbering system totally rocks and is all we need right? Well, maybe if this was 1980 and you were balancing your checkbook. Today if you include what your phone, tablet, on-board car systems, computer, this blog, cable-box and TV sets utilize you may be SHOCKED to learn that the Binary Number System is what you use (whether you realize it or not) all day long, every day. Unless you’re an accountant the Binary system is what makes your modern day life function in the form of Binary Computer Code; but as I alluded to earlier: binary number systems have existed throughout the world for thousands of years!

So, what’s this Binary system in the modern sense? It’s Base-2. The two digits are (usually) a zero and a one. You've probably seen how numbers and letters and symbols on your computer keyboard are changed to a series of 1s and 0s to be understood by the computer. For example, the phrase “This is the number 73” in binary code is:
“01010100 01101000 01101001 01110011 00100000 01101001 01110011 00100000 01110100 01101000 01100101 00100000 01101110 01110101 01101101 01100010 01100101 01110010 00100000 00110111 00110011”

Okay, that’s computer coding—but what about converting a ‘regular’ (Arabic) number into binary? Do I need an online binary converter? How about an abacus or special phone app? Why don’t you just try a nice piece of paper and a pencil?






Above is the number 131 two ways: base-2 binary and base-10. For Binary you divide by 2 and write the whole number down (65) and write the remainder of 0 or 1. Once you’re done you look to the column at the right and you've got your binary 0s and 1s all lined up. Below that I did it in Base-10 to show that it works that way too! Try it in base-8 or anything else crazy you can think of.

Oh, did I say base-8 was crazy? Like 8-bits make a byte and 1024-bytes make a kilobyte. Not so crazy, huh? Although some computer applications (USB thumb drives, storage space, etc) actually use a combination scheme where only 1000 bytes make a kilobyte! Either or is potentially correct, kind of like disc vs. disk. For thousands of years there have been variations in systems that were supposed to be ‘numbers and math’, something most people think of as set in stone. Such is life sometimes. Base-8 is referred to as Octet, base-16 (which is also popular among computers and software) is called hexadecimal. There are many number systems out there. So where can you quickly see an octet and be impressed? Check your computer’s IP address. It is simply a series of four octet numbers, separated by dots:


“255.255.255.255


By the way, I got the trick of easily converting to binary with pencil and paper from Isaac Asimov. I mean, not personally, but from his book of essays “On Numbers”. As I recall he didn't seem to remember where he got it from, and I've never heard or seen anyone else use it in my daily life.






Now you may think, “why all these systems”? Well, most non-European languages have no names for numbers much higher than 10. So, they’re open to creating systems—especially from language (alphabets)—and you get used to what you know. Also, many units of measure were based on physical phenomena like: I have ten fingers, the width of my index finger seems sort of close to the width of yours, my foot at the end of my leg marks a single pace—unless you and I have different shoe sizes, oops—people do have different shoe sizes, so older measures usually are not fantastically uniform.

Although: the seed of the Carob Tree was pretty darn uniform—so much that they used it to measure diamonds against. We still call it the ‘carat’ and it’s reasonably certain that if you picked a seed (actually a pod containing a bunch of the seeds) off a Carob Tree today it would be pretty much the same as one from a thousand years ago; and if you go to a grocery store and buy a bag of them and spill them on your kitchen floor—they’d all be the same size. Yes, you might get a weird malformed one I supposed, but the other zillion seeds on your floor would be the same size and weight as far as you could tell without using a very expensive digital scale. There are 5 (average) Carob seeds to a gram. However, between the East and West Mediterranean there actually exists a variation. One side the seeds were all one weight, the other side they were a second weight. So in the 1800s some British guys just weighed one eastern and one western seed together and divided by two. Happily it came out to 0.2 grams, which is 200 milligrams. Take five together and you get 1 gram. Isn't that convenient? It is! Just as long as there isn't a drought and you end up with acres of funny lookin' Carob seeds that is.

Variations and naming conventions make number systems confusing to most people. Take the Duodecimal system (not the Dewey Decimal system that many libraries use). You’d think the “duo” would mean two right? Nope, it’s base-12. Why on Earth would anyone want to count anything using base-12? Well, for starters, twelve hours plus another twelve hours equals a day on Earth! That’s pretty important. 

Likewise, twelve inches in a foot, but that’s the Imperial measurement system which is another can of worms entirely. Although, it just occurred to me that if a day has 24 hours it might be base-24, which is called the “quadrovigesimal” system—but it’s only called that by a very limited number of people on this planet that realize it exists. You probably shouldn't try to slip it into casual conversation.

So If you think you hate math but want to delve into things like the above, try reading some math history