Sunday 18 August 2024

A bit of mathematics

Dr. Setun joined us again at one of lady Adelath's tea and cookie confession sessions. Dr. Setun works as a sedative for the old lady, she confessed as much on an earlier occasion. And indeed, she nodded off while he started explaining why Triglavian base-3 computation is superior. Even mister Maulus took a nap, on her lap.

I listened. To me, there is something suspicious about his idolization of the Triglavian system. Perhaps, as a codebreaker during the war, he has been exposed too much to their corrupting influence.

Anyway, here is his argument. Remember that our decimals are base-10 numbers, while our computer bits are base-2 numbers. Some claim we just picked the number ten because that is how many fingers we have, so it is easy for finger-counting math. The first computer builders picked binary because in essence they worked with switches that can be on or off, just two values.

In general, you need more digits to represent an arbitrary number, if you use a smaller base. The number 82 has two digits in decimal, but in binary it is 1010010 : that is seven digits long. In a general base B, the amount of digits required to represent a number is given by the base-B logarithm of that number, logB(N). Or, to be precise, the first integer larger than that value.

So, it seems that a larger base, with its fewer digits, is more efficient at storing and manipulate numbers. However, there is also a cost: any digit can take on B values. There are more different symbols in our decimal system than the 0 and 1 of the binary system. So, the overal cost is actually logB(N). Now, if you try out several values for B, you will indeed conclude that B=3 gives the lowest cost. Note that, if you do not restrict yourself to integers, the function logB(N) becomes minimal when B equals St. Euxon's Holy Constant e=2.71828... for which 3 is the closest integer.

I tried to refute his argument, by claiming that most operations involve two-digit gates, for example addition or multiplication of two numbers. These kind of gates are characterized by B2 entries. So, for computation, B2logB(N) is the function to minimize. For that case, actualy B=7 is the best number system. 

Hopefully we are not invaded by the Heptavians next.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.