Monday, January 25, 2010

Base-n arithmetic and wiggle

We saw above that

`\qquad\qquad\qquad 5_{10}3_{10}5;_{10}4_{10}9  =  535.49.`

Being explicit about the base, we can write

`\qquad\qquad\qquad 5_{10}3_{10}5;_{10}4_{10}9  =  535.49_{10}.`

Translating numbers in other bases into wiggle is an immediate generalization.  As a first example, suppose we are trying to evaluate

`\qquad\qquad\qquad 10110111_{2}.`

We rewrite this, with the same digits---or bits---in the same order as the superdigits, and making each interbase be 2, so that



`\qquad\qquad\qquad 10110111_{2}  =  1_{2}0_{2}1_{2}1_{2}0_{2}1_{2}1_{2}1.`

Telescoping from left, we get

`\qquad\qquad\qquad 1 xx 2  =  2,`
`\qquad\qquad\qquad 2 + 0  =  2,`
`\qquad\qquad\qquad 2 xx 2  =  4,`
`\qquad\qquad\qquad 4 + 1  =  5,`
`\qquad\qquad\qquad 5 xx 2  =  10,`
`\qquad\qquad\qquad 10 + 1  =  11,`
`\qquad\qquad\qquad 11 xx 2  =  22,`
`\qquad\qquad\qquad 22 + 0  =  22,`
`\qquad\qquad\qquad 22 xx 2  =  44,`
`\qquad\qquad\qquad 44 + 1  =  45,`
`\qquad\qquad\qquad 45 xx 2  =  90,`
`\qquad\qquad\qquad 90 + 1  =  91,`
`\qquad\qquad\qquad 91 xx 2  =  182,`
`\qquad\qquad\qquad 182 + 1;  =  183;`

so that in the end

`\qquad\qquad\qquad 10110111_{2}  =  183.`

Let's try one with a fractional part.  What is

`\qquad\qquad\qquad 102.21_{3}?`


Rewriting in wiggle, we have

`\qquad\qquad\qquad 102.21_{3}  =  1_{3}0_{3}2;_{3}2_{3}1.`

Telescoping from the left and the right, we get

`\qquad\qquad\qquad 1_{3}0_{3}2;_{3}2_{3}1  =  (3 + 0)_{3}2;_{3}2_{3}1,` `\qquad\qquad\qquad\qquad  =  3_{3}2;_{3}2_{3}1,`
`\qquad\qquad\qquad\qquad  =  (9 + 2);_{3}2_{3}1,`
`\qquad\qquad\qquad\qquad  =  11;_{3}2_{3}1,`
`\qquad\qquad\qquad\qquad  =  11;_{3}(2 + \frac{1}{3}),`
`\qquad\qquad\qquad\qquad  =  11;_{3}\frac{7}{3},`
`\qquad\qquad\qquad\qquad  =  11\frac{7}{9}.`

Odder bases are also easy to calculate with.

No comments:

Post a Comment