Theiling Online    Sitemap    Conlang Mailing List HQ   

Re: Counting in Toono

From:Lars Henrik Mathiesen <thorinn@...>
Date:Monday, May 10, 1999, 16:34
   Date:         Sun, 9 May 1999 11:54:50 +0300
   From: Dan Sulani <dnsulani@...>

   "David G. Durand" wrote:

   > It's based on the "balanced ternary" system discussed by Donald
   > Knuth, which has the digits 0, 1, and -1.
   >
   > You can do a base-10 variation, but it's much nicer with an odd
   > base, because you want to have the same number of positive and
   > negative digits on either side of the zero.

What's wrong with ambiguous representations? You could do base 10 with
digits -5 .. 5, for instance, and have lots of fun deciding what the
traditional/preferred representation of numbers will be. A bit like
Roman numerals, where iiij and iv are both legal representations of 4,
and the form used depends on time, place and style.

Off the top of my head, one possible rule is that +5 and -5 will
always follow an even digit if possible --- but of course we must have
exception: the number 15 is 10+5. (Only 15, though. 150 is still
200-50, and 1.5 is 2 - 0.5). The times-5 table runs:

        5, 1;0, 1;5, 2;0, 2;5, 3;0, 4;-5, 4;0, 4;5, 5;0.

Systems like this (usually base 4 with digits -2 to 2) are very useful
internally in computer floating point units, because they give the
designer an error margin in the division algorithm. Remember when you
do long division by hand, sometimes getting the next quotient digit is
a very close decision --- and if you guess wrong, you have to go back
and correct. With the ambiguous system both choices work, in the sense
that you can carry the calculation through, and then go back over the
result and correct any places where the wrong representation came out.

   David, it's a wild system. :-) I like it. Could it be extended to
   handle fractions? Which way would decimals and transcendentals like
   "pi" go?

Balanced ternary fractions work just like decimal fractions --- the
digits after the point get place values that are powers of one third.
You just have to be aware that the interval covered by numbers that
begin with a certain string of digits is centered on the value of
those digits --- unlike decimal numbers, where that value is the lower
end of the interval. An example:

        Decimal fractions 0.1xxx cover the interval [1/10 to 2/10].
        Ternary fractions 0.1xxx cover the interval [1/6 to 1/2].

In both cases you have to deal with the 'all-9' problem: In decimal,
0.9999... is the same as 1.0000..., in balanced ternary 0.1;1;1;1;...
is the same as 1.-1;-1;-1;-1;... (and has the value 1/2).

            And for Heaven's sake what about complex numbers with all
   that square root of minus one stuff? The mind boggles!

The usual method works just fine: let 'i' stand for the square root of
minus one, and write complex numbers as a + b*i where a and b are in
whatever strange system you just invented.

Or you can note that -1+i is a fourth root of -4, and go from there:
the digits are 0 and 1, and the first 5 place values are

        1, -1+i, -2i, 2+2i, -4

This system works, but writing non-terminating fractions (pi + e*i,
for instance) in it is really nasty. It turns out that the areas in
the complex plane that correspond to the intervals above, have fractal
outlines (although each area is a connected set) so you may have to
calculate 'ahead' a lot before you can determine a certain digit.

(BTW, if you group the digits in fours, this is also an example of a
system with a negative base (-4 here)).

Lars Mathiesen (U of Copenhagen CS Dep) <thorinn@...> (Humour NOT marked)