Tuesday, January 26, 2010

The reversed odometer

For simplicity, consider a vehicle with an old-style mechanical odometer, and a separate trip odometer with four digits, the lowest digit representing tenths of miles.  Reset the trip odometer so that it reads all zeroes, and drive a tenth of a mile backwards.  The odometer should now read `999.9`.  Let's ignore the decimal point, and work in distance units of a tenth of a mile.  Then the trip meter reads `9999` units.  What it should read is `-1` unit, or some equivalent to that.

It should be clear that the trip meter, if unreset, cycles after every `10000` units of travel.  It could measure the actual distance since it was last reset, or it could be any multiple of `10000` units out.  Anyway, if the thousands digit reads `9`, but the meter is too high by `10000` units, then to correct the problem, we can simply remove `10` thousand from `9` thousand.  This gives `-1` thousand, or `\bar{1}` thousand---i.e. the thousand digit might say `9` but it will be better for us to read it as `\bar{1}`.

We can put this in wiggle, and calculate

`\qquad\qquad\qquad \bar{1}999  =  \bar{1}_{10}9_{10}9_{10}9,`
`\qquad\qquad\qquad\qquad  =  \bar{1}_{1000}999,`
`\qquad\qquad\qquad\qquad  =  -1000 + 999,`
`\qquad\qquad\qquad\qquad  =  -1.`

Put another way, provided we read the high order digit in suitable way, as string of nines, or else a `-1` followed by a string of nines, can be reasonable way to express `-1`.

This particular notation for negatives is called tens complement.  In tens complement, as for the odometer driven in reverse :

`\qquad\qquad\qquad \ldots999  =  -1,`

`\qquad\qquad\qquad \ldots998  =  -2,`

`\qquad\qquad\qquad \ldots997  =  -3,`

`\qquad\qquad\qquad\qquad\qquad\qquad \vdots`

A second cut at negative quantities---complementary representations

Fashioning negative quantities in sign and magnitude form, as we did in the last post, requires negation, so called because it makes positive quantities negative.

This is probably not the best of names, because negation also makes negative quantities positive.  It also changes left to right, north to south, east to west, debit to credit, and vice versa in each case.  There is nothing inherently positive or negative about east and west, but they are clearly opposites, and negation turns the one into the other. 

So a better name might be something like turning, reversal, or flipping, but we are probably stuck with negation---the negative of east is west, and vice versa.

Here, however, we are dealing with quantities that do have a sign.

The negative in sign and magnitude form of my littlest's birthweight, with the magnitude expressed in mixed units, is :

`\qquad\qquad\qquad -(7" lb." + 12" oz.").`

Negating each of the terms separately, we get

`\qquad\qquad\qquad -(7" lb." + 12" oz.")  =  \bar{7}" lb."  +  \bar{12}" oz."`

This is what we would use in calculations.  It turns out, however, not to be the only form, or even the most convenient.

Complementary representations of negative quantities are particularly convenient for addition.  In a complementary representation, we allow only the amount of the largest unit to be negative, requiring all the other parts of the mixed quantity to follow the usual rules for standard form, including requiring them to be non-negative.  We get the complementary form of  `\bar{7}" lb."  +  \bar{12}" oz."` by borrowing (when already in debt...) :

`\qquad\qquad\qquad \bar{7}" lb."  +  \bar{12}" oz."  =  \bar{7}" lb."  -  1" lb."  +  16" oz."  +  \bar{12}" oz.,"`
`\qquad\qquad\qquad\qquad =  \bar{8}" lb."  +  4" oz."`

Now that we have the negative of my son's birthweight, in complementary form, we can use it to calculate his growth from birth at his other weighings.  Instead of subtracting his birthweight from his subsequent weights, we can add the negative of his birthweight in this form to these subsequent weights.

So my littlest's growth by Friday is

`\qquad\qquad\qquad (7" lb." +  8" oz.") + ( \bar{8}" lb."  +  4" oz."),`
`\qquad\qquad\qquad =  (7 - 8)" lb."  + (8 + 4)" oz."),`
`\qquad\qquad\qquad =  \bar{1}" lb." + 12" oz.",`

where the result is just a complementary form for `-4" oz."

His growth by today, on the other hand, is

`\qquad\qquad\qquad (8" lb." +  0" oz.") + ( \bar{8}" lb."  +  4" oz."),`
`\qquad\qquad\qquad =  (8 - 8)" lb."  + (0 + 4)" oz.),`
`\qquad\qquad\qquad =  0" lb." + 4" oz.".`

This method may look unnecessarily awkward for small and simple quantities such as we have here.  It is nevertheless extremely useful.  The usual method by which a computer represents a negative integer is as a complementary form in base two; the usual method of representing negative common logarithms uses complementary form; complementary form can be helpful in ordinary arithmetic.

Perhaps the most graphic example of complementary form mixes the old style mechanical odometer and the imagination.  But that is a topic for another post.

A first cut at negative quantities

One can subtract directly, as we did in the last posting, e.g.

my littlest son's weight today Tuesday - his weight at birth on Thursday = 4 oz.

Sometimes, however, such subtractions result in a negative answer, e.g.

his weight at his first doctor's visit on Friday - his weight at birth on Thursday = -4 oz.

The most familiar way to represent negative quantities is as the opposite, or negative, of a positive quantity.  This is convenient for many purposes, but it is not the only way, or even the most convenient, as we shall see.

8 pounds and grown by---how much?

Our littlest, born Thursday morning, and weighing  7 pounds, 12 ounces then, but 7 pounds, 6 ounces at his checkup late Friday afternoon, was weighed at his second checkup today.

It is common for newborns to lose weight and only come up to birthweight between one and two weeks, apparently, but that has not been the time scale with our children.  Today, our littlest weighed in at 8 pounds even.  (No, again, I am not faking the figures.  I am starting to wonder whether those who measure him round to the nearest quarter pound, but I don't think they do.)

This provides an opportunity to look at subtraction of mixed units, otherwise known as compound subtraction.  It is reasonably obvious that my newborn has experience net growth of four ounces between his birth weighing and today's weighing.

One way to subtract is to do it term by term, so that

`\qquad\qquad\qquad (8" lb."  +  0" oz.")  -  (7"  lb."  +  12" oz."),`
`\qquad\qquad\qquad\qquad =  (8 - 7)" lb."  +  (0 - 12)" oz.,"`
`\qquad\qquad\qquad\qquad =  1" lb."  + \bar{12}" oz.,"`

where the overbar represents negation, as before.  This result is true, but not in standard form.  We rectify by a subtractive kinds of carrying, known as borrowing :

`\qquad\qquad\qquad 1" lb."  + \bar{12}" oz."  =  0" lb."  +  16" oz."  + \bar{12}" oz.,"`
`\qquad\qquad\qquad\qquad =  0" lb."  +  (16 - 12)" oz.,"`
`\qquad\qquad\qquad\qquad =  4" oz."`

Converting fractional units into mixed units

We now present two different methods for unwrapping a fractional part into mixed units.

Suppose now that we wish to convert `5\frac{7}{9}` yards into yard, feet, and inches.

In the first method, we proceed by splitting into whole and fractional parts, and rewriting the fractional part in smaller units, e.g

`\qquad\qquad\qquad 5" yards"  +  7/9" yards"  =  5" yards"  +  7/3" feet",`
`\qquad\qquad\qquad\qquad =  5" yards"  +  2 1/3" feet,"`
`\qquad\qquad\qquad\qquad =  5" yards"  +  2" feet"  +  1/3" feet,"`
`\qquad\qquad\qquad\qquad =  5" yards"  +  2" feet"  +  4" inches."`

In the second method, we first multiply `5\frac{7}{9}`,  by `3` and by `12`, to get `208`, and then we use successive division as in the last posting.  We can even shorten this method by extracting the `5` first, multiplying just the `\frac{7}{9}` by `3` and by `12` to get `28`, and then dividing as before; this spares us the last division : `28  =  2_{12}4.`

Converting single unit expressions into mixed unit expressions in standard form

So far, we have looked at converting mixed units to a single unit, and also at performing addition while remaining in mixed units.  It is time to learn how to go from single units expressions to given mixed units.

Suppose, for instance, we wish to convert `208` inches into yards, feet, and inches.  One can of course say trivially that

`\qquad\qquad\qquad 208  =  0_{3}0_{12}208,`

i.e. 0 yard, 0 feet, 208 inches.  That probably isn't what we wanted, so we need to be more specific---we want to convert into yards, feet, and inches in standard form.

The way to to this is by converting smaller units into complete larger units, i.e. by carrying; the way to do that is by successive division.  How many whole feet, i.e. how many complete lots of `12` inches, go into `208` inches?  Dividing `12` into `208`, i.e. `12 \\ 208` or `208 -: 12`, we find that `12` goes `17` times, with a remainder of `4`, often written `17  "r"  4`.  In  `17  "r"  4`, "r" stands for "remainder".  Instead of this, we shall write `17_{12}4`, because if we did the division correctly, then `17_{12]4` has to be a wiggle expression equivalent to `208`.

In any case, `208` inches is equivalent to `17` feet and `4` inches, and this would be our final answer if we were using only feet an inches as units.  But since we are also using yards, we divide `17` by `3`, whence `17  = 5_{3}2`, i.e. `17` feet is `5` yards and `2` feet.

So in the end, `208` inches is `5` yards, `2` feet, `4` inches.  In wiggle without units,

`\qquad\qquad\qquad 208  =  5_{3}2_{12}4.`

The calculation proceeds from right to left, dividing by successive interbases, writing only the remainder, and passing the quotient to the next interbase for division.  The final quotient is then written before the leftmost interbase.

The work of successive division can be set forth as follows :

`\qquad\qquad\qquad{:"       "\ul{"      5"}_{"   3 "}2`
`\qquad\qquad\qquad{:"   3 "\ul{")   17"}_{" 12 "}4`
`\qquad\qquad\qquad{:" 12 )  208."`

Brave souls may even elect to drop the divisors on the left, and write them just on the right, at levels between the lines, from the beginning.


`\qquad\qquad\qquad{:"       "\ul{"      5"}_{"   3 "}2`
`\qquad\qquad\qquad{:"      "\ul{"    17"}_{" 12 "}4`
`\qquad\qquad\qquad{:"         208."`

Place value, superposition, and all that

Consider the number `535.49`.  It can be written as a series of multiples of powers of ten, e.g.

`\qquad 535.49 = 5 (10 xx 10)  +  3 (10)  +  5 (1)  +  4 (1/10)  +  9 (1/10 xx 1/10),`
`\qquad\qquad = 5 (100)  +  3 (10)  +  5 (1)  +  4 (0.1)  +  9 (0.01),`

We have already seen a some correspondences between how decimals work and how wiggle works.  Consider then

`\qquad\qquad\qquad 5_{7}2_{24}10;_{60}45_{10}7  =  898\frac{457}{600}`

We can write

`5_{7}2_{24}10;_{60}45_{10}7 `
`=  5  (7 xx 24) +  2 (24)  +  10 (1)  +   45 (1/60)  +  7 (1/60 xx 1/10)`
`=  5  (1_{7}0_{24}0) + 2 (1_{24}0) + 10 (1) +  45 (0;_{60}1) + 7 (0;_{60}0_{10}1).`

This decomposition tells what each superdigit contributes to the total.  The contribution is the product of the size of the superdigit itself (e.g. `5`) and the place value associated with where the superdigit is placed (e.g. `7 xx 24`).  The correspondence with decimals should be obvious.

Another thing to notice is that superposition holds just as well for wiggle expressions as it does for mixed units and for decimal notation.  Superposition is the idea that each superdigit contributes a known amount to the sum, in fixed proportion to its size, and independent of what the other superdigits are contributing.