Friday, March 26, 2010

Idle Thoughts of an Idle Mouse: Nonstandard Systems

And idle I am - it is spring break. Without the distraction of school, two things are catching my interest right now: nonstandard numbering systems and nonstandard measuring systems.

Numbering systems, as we usually think about them, have a fixed base (b) that is raised to an integer exponent (x) that varies by increments of one. That made sense in my head. The point is, numbering systems tend to be regular and predictable. Each place value is determined by f(x)=b^x.

This gets a little bit strange when the base isn't a positive integer. Think about base pi; it isn't as complicated as it sounds, I promise. Pi^0 is 1, pi^1 is pi, pi^2 is... um, pi^2. Compare it to decimal:

Decimal: 10^2=100, 10^1=10, 10^0=1
Pi: pi^2=pi^2, pi^1=pi, pi^0=1

The exact same pattern. It is going to have a whole different set of irrational numbers of course, but this happens to some degree with any change of base (the only base with no irrational numbers, I suspect, is infinite). Now, examples: (after the jump)

base: 10 pi
----- 01 01
----- 02 02
----- 03 03
----- 04 10.220...
----- 05 11.220...
----- 06 12.220...
----- 07 20.202...

And so on. Not actually that interesting, once you think about it. But it did undermine one assumption I had about numbering systems - that the range of digits the number system uses (decimal uses 0-9, binary uses 0-1) is base-1. Clearly, there can't be 2.14159265 individual digits. It just doesn't work like that.

Now: negative numbers. Good fun! Consider base -10. According to the Google monster, this is called negadecimal. Apparently I am not the only one to think of this, which is at once disappointing and a great relief. Compare the place values:

Decimal: 1, 10, 100, 1000
Negadecimal: 1, -10, 100, -1000

And so on. The sign alternates, because that is what happens. The conversions are straightforward. For example:
Decimal number: 12
1(10) + 2(1) = 12
Negadecimal equivalent: 192
1(100) + 9(-10) + 2(1) = 12

Simple. A little trickier to figure out, but not so bad.

Now this same concept can be applied to all sorts of fun and exciting numbers, including ones that pretend to be letters, like i and e. Imaginary numbers are pretty cool, too, but I think you can figure that out all by yourself.

Once changing the base from one number to another gets old (when someone proposes base 79 I am no longer excited because I am a jaded, jaded little girl), try making the base vary. Sometimes it is decimal! Sometimes it is binary! No one knows where it will strike next! There are a wealth of opportunities here.

But why stop now, confined within this f(x)=b^x formula? I am not going to let this hold me back. Number systems that aren't positional are actually very common. Tally marks (base 1) aren't exactly positional, as the position is irrelevant here, but they aren't exactly that exciting, either. The example that I thought of first is money - I've noticed how interesting money is ever since I started spending hours of my life putting it into cash registers. Consider the place values for modern US currency:
100.00, 50.00, 20.00, 10.00, 5.00, 1.00, 0.25, 0.10, 0.05, 0.01

This doesn't fit the happy paradigm of f(x)=b^x at all. People act all confused when I talk about base pi, but this is, if you ask me, far stranger. While it is extraordinarily common, we talk about money in terms of the decimal value of the bills, rather than in the currency number system, so no one has to think about it very much. If we did use the numbering system in money, it would be something like this:

base: 10 -- US dollars
----- 00.01 0.0001
----- 00.05 0.0010
----- 00.10 0.0100
----- 00.26 0.1001
----- 01.05 1.0010
----- 10.00 100.0000
----- 16.14 111.0104
----- 33.58 1103.2013

It is pretty obvious why we don't use this, but nonetheless, every time you pay for something in cash, you are using this system.

Time is pretty strange, too. 60 seconds in a minute, 60 minutes in an hour, 24 hours in a day, 7 days in a week, 52.177 weeks in a year, a varying number of weeks in a month, and 12 months in a year. And this is a system that we actually use on a regular basis without really converting it back to decimal (although we do handle the numbers above 9 using the decimal system). Also, the entire English System.

I am sure there are many other examples of systems like this that aren't coming to mind right now.

Now, this is quite enough of my rambling thoughts on how interesting (and uninteresting) numbering systems are, and for all of you (anyone? hellooo?) still reading, I will go on about nonstandard measuring systems at a later date.

1 comment:

  1. If a recruit was doing a bit too well with my programming questions during my msft interviews, I would attempt to stump them with the base -2 question. Now that you can represent a number in negadecimal, what are the rules for +,-,*, and /? How about the difference in one's complement or two's complement machines? ;-)

    ReplyDelete