Wednesday, March 3, 2010

One logarithm to rule them all

In technical material, one often comes upon logarithmic units of various sorts : decibels, astronomical magnitudes, nepers, bits, octaves, semitones, and so forth.

All of the logarithmic units of which I am aware are defined by an equation of the form

`\qquad\qquad\qquad x = R\cdot\log_a(Q_1/Q_0)\cdot"lgunit"`,

where
  • `R` is a simple nonzero rational number (positive or negative, often `1` or `-1`),
  • `a` is a base of logarithms, (in practice, this is always one of just three possibilities: `10`, `"e"`, or `2`,)
  • `Q_1` and `Q_0` are quantities, (`Q_0` is sometimes a fixed reference quantity,) and
  • `"lgunit"` is the particular logarithmic unit being defined by the equation.
While this is how logarithmic units are universally defined---even in standards documents---it is far from satisfactory.

In particular, it does not show the sense in which a logarithmic unit is, in fact, a unit.  In this posting, we look at a better way of doing this.

First, let us define the generic logarithm function, `"lg"(.)`.  A function is a object that, whenever you put something into it, you get something out.  For any given function, the thing you get out depends completely on what you put in.

A function is defined by the possible things you can put into it, i.e. the possible inputs, and then, for each such input, the output that the function gives, and also---this seems perverse at first---a given set of outputs that includes but which can be larger than the set of actual outputs.

The set of possible inputs is called the domain of the function.  The outputs that actually occur are called the image of the function.  The given output set---often a larger set that contains the image---is called the codomain of the function. 

Two functions are the same they share the same domain, the same codomain, and if for every possible input from the domain, they give the same output in the codomain.

It was once customary to talk about the range of a function, but this term is now little used---it was sometimes used to mean the image, and sometimes the codomain.

The domain of the generic logarithm, at least as we shall define it here, is the positive real numbers.

The codomain---and image---of the generic logarithm, is an otherwise unspecified set `L`.

The generic logarithm function is almost completely specified by the following, true for all real numbers `x>0` and `y>0`.  (The `almost` amounts to a continuity assumption that allows us to extend from rational powers to real powers.) :

`\qquad\qquad\qquad "lg"(x y) = "lg"(x) + "lg"(y).`

We already appear to be in difficulty.  Since we have not specified `L` to consist of numbers, or even of quantities, the equation just given defines how to add things in `L`.

The generic logarithm rather looks like a swindle.  What it says is, take a multiplication table, e.g. including stubs :

`\qquad\qquad\qquad[(xx,1,2,3),(1,1,2,3),(2,2,4,6),(3,3,6,9)]`.

Now replace number by the value of its generic logarithm, which is best thought of a kind of alter ego, or doeppelganger for the number :

`\qquad\qquad\quad[(\square,"lg"(1),"lg"(2),"lg"(3)),("lg"(1),"lg"(1),"lg"(2),"lg"(3)),("lg"(2),"lg"(2),"lg"(4),"lg"(6)),("lg"(3),"lg"(3),"lg"(6),"lg"(9))]`.

And now call the new table an addition table for the values of the logarithms :

`\qquad\qquad\qquad[(+,"lg"(1),"lg"(2),"lg"(3)),("lg"(1),"lg"(1),"lg"(2),"lg"(3)),("lg"(2),"lg"(2),"lg"(4),"lg"(6)),("lg"(3),"lg"(3),"lg"(6),"lg"(9))]`.

---all we have done is renamed everything in the table and called it an addition table.  Since we haven't required the various values to be distinct, this procedure cannot fail---at worst, we get an entire table full of zeroes, but no contradictions.

It isn't really a swindle, however, and it turns out that each positive number gets its own distinct logarithm :  what looks like mere rebranding turns out to have some content because multiplication of positive numbers behaves a great deal like addition of real numbers.

I find that it helps to have a mental picture of what generic logarithms do.  Pick any fixed positive real number `f \ne 1` as a base.  (I like to think of a small positive fractional tolerance `\epsilon`, and let `f = 1 + \epsilon`, so that `f` is slightly greater than `1`.)  Then any positive real number `x` can be written

`\qquad\qquad\qquad x = f^{p_x}`

for some real number `p_x`.  The subscript is to remind us that the value of `p_x` depends on the value of `x`.  `p_x` is the number of factors of `f` required to make `x` :

(We can even require `p_x` to be an integer, if we are content to tolerate a fractional error of about `\epsilon/2`,

`\qquad\qquad\qquad x \approx (1+\epsilon)^{p_x}`,

but there is no need to do this just yet.)

`p_x` is a measure of how powerful `x` is as a multiplier.  The specific size of `p_x` is not important---it depends not only on `x` but on the particular choice of `f`.  What is important is that, for any two positive real numbers `x` and `y`, if

`\qquad\qquad\qquad x = f^{p_x}` and `y = f^{p_y},`

then the ratio of `p_y` to `p_x` does not depend on the particular choice of `f`.

This is like the situation for physical quantities---the ratio of a pair of lengths, or a pair of weights, or a pair of electric currents does not depend on our particular choice of length unit, weight unit, or current unit.

Each positive real number, then, has its own particular multiplying strength, and that multiplying strength is a quantity.  The generic logarithm function takes in a positive real number as input, gives as output the multiplying strength of the number.

(In technical terms, `L`, the codomain of lg, is a one dimensional real vector space.  For comparison, the values of physical quantity 'electric current' also belong to a one dimensional real vector space. )

Indeed

`\qquad\qquad\qquad y = f^{p_y} = f^{p_x \cdot p_y/p_x} = (f^{p_x})^{p_y//p_x} = x^{p_y//p_x}`

In other words, the ratio of the multiplying strengths of `y` and `x` is the power one has to raise `x` to get `y`.  Since, e.g. `2^3 = 8`, the multiplying strength of `8` is three times the multiplying strength of `2`,

`\qquad\qquad\qquad "lg"(8) = 3 xx "lg"(2).`

Yet another way to write this is

`\qquad\qquad\qquad \log_2(8) = 3.`

Comparing these, we see that

`\qquad\qquad\qquad \log_2(8) = 3 = {"lg"(8)}/"lg"(2).`

This illustrates a general truth.  The following are equivalent, for all positive real numbers `x` and `b` and all real numbers `p` :
  • `x = b^p`,
  • `"lg"(x) = p "lg"(b)`,
  • `x` has `p` times the multiplying strength of `b`,
  • `\log_b(x) = p`,
  • `\frac{"lg"(x)}{"lg"(b)} = p`. 
From the last two of these, we have that

`\qquad\quad\qquad \log_b(x) = \frac{"lg"(x)}{"lg"(b)}.`

This connects the usual theory of logarithms to the generic logarithm.  The logarithm of a given number to a given base number is the ratio of their generic logarithms.  While generic logarithms are quantities rather than numbers, ratios of generic logarithms are numbers.

From this, we also get 

`\qquad\quad\qquad "lg"(x) = \frac{"lg"(x)}{"lg"(b)} xx "lg"(b) = \log_b(x) xx "lg"(b).`

It proves convenient to name some particular values of the generic logarithm :
  • `1" decade" = "lg"(10)`,
  • `1" neper" = "lg"("e")`,
  • `1" octave" = "lg"(2)`.
In that case,
`\qquad\qquad\qquad "lg"(x) = \frac{"lg"(x)}{"lg"(10)} xx "lg"(10) = \log_{10}(x)" decades",`

`\qquad\qquad\qquad\qquad\qquad = \frac{"lg"(x)}{"lg"("e")} xx "lg"("e") = \log_{"e"}(x)" nepers",`

`\qquad\qquad\qquad\qquad\qquad = \frac{"lg"(x)}{"lg"(2)} xx "lg"(2) = \log_{2}(x)" octaves".`

The decade (dec), neper (Np), and octave (oct) serve as different units of the single quantity `"lg"(x)` :

`\qquad\qquad "lg"(x)  = \log_{10}(x)" dec" = \log_{"e"}(x)" Np" = \log_{2}(x)" oct".`

This is somewhat similar to saying, for a line segment `U`,

`\qquad\qquad "length of "U = 1.5" yards" = 4.5" feet" = 54" inches".`

It would be possible, of course, to define three different quantities called, say, the yardiness, feetiness, and inchiness of a line segment `U`, and say that the yardiness of `U` is `1.5`, its feetiness is `4.5`, and its inchiness is `54`.

Of course that seems a little strange---but aren't we doing something rather similar when we say that the common logarithm of `1012` is slightly over `3`, its base `2` logarithm is just under `10`, and its natural logarithm is about `6.92`?

It seems preferable to have just one logarithm, the generic one, and to write, and also think :

`\qquad\qquad "lg"(1012)  \approx 3.005" dec" \approx 6.920 " Np" \approx 9.983 " oct".`

Another way to avoid having using multiple quantities is to strongly favor one unit, to the exclusion of other possibilities.  One could agree to avoid the use of yardiness and inchiness, favoring feetiness by default.  Or one could favor by default the base `"e"` (or 'natural') logarithm.

This latter trick works, as long as one is consistent.

Nothing in the definition of a length of, say, a foot, says that we cannot subsequently equate a foot to the number `1`.  If we do, than footiness and length become the same thing.

Similarly, there is nothing in the definition of the generic logarithm that prevents us from subsequently identifying, say, the neper with the number `1`.  In that case, the generic logarithm would be equivalent to the natural logarithm.

Both manoeuvres, equating length with footiness, or multiplying strength with the value of the natural logarithm, are a kind of cheat, however.

Such ideas as length and multiplying strength are best left without such encumbering identifications.  They are best kept generic.

    A continuous stripy multiplication table

    Sometimes, numbers and other quantities are used to count segments : "chapter one, chapter two, chapter three"; "first mile, second mile, third mile"; "first year, second year, third year".

    Sometimes, they are used to mark waypoints: "start (milestone 0), milestone 1, milestone 2, milestone 3"; "0 years old, first birthday, second birthday, third birthday".

    Sometimes, board games are played with pieces placed in the spaces: chess, draughts (checkers), snakes and ladders, noughts and crosses (tic-tac-toe).

    Sometimes, board games are played with pieces placed at the intersections: nine men's morris, go.

    In all of our multiplication tables so far, numbers have occupied cells in an array.

    Let us now fashion a multiplication table where the numbers are now thought of as labels for points.

    agraph
    width=400; height=400;
    xmin=(9.9); xmax=11.1;
    ymin=(-11.1); ymax=-9.9;
    marker = "none";
    marker = "dot";
    stroke = "none";
    markerfill = "blue";
    a=[];
    a[0]=[10,-10]; text([10,-10],"1",above);
    a[1]=[11,-10]; text([11,-10],"10",above);
    a[2]=[10,-11]; text([10,-11],"10",above);
    a[3]=[11,-11]; text([11,-11],"100",above);
    path(a);
    endagraph

    These four points are the corners of a square.  The idea now is to think of every point in the square as having a number, so that all the numbers form a continuous stripy multiplication table.  The line joining through the two `10` points consists of points that all have the value ten.  This is a stripe of the continuous table.

    We can mark some other points, to help see how things are working :

    agraph
    width=400; height=400;
    xmin=(9.9); xmax=11.1;
    ymin=(-11.1); ymax=-9.9;
    marker = "none";
    marker = "dot";
    stroke = "none";
    markerfill = "blue";
    a=[];
    a[0]=[10,-10]; text([10,-10],"1",above);
    a[1]=[11,-10]; text([11,-10],"10",above);
    a[2]=[10,-11]; text([10,-11],"10",above);
    a[3]=[11,-11]; text([11,-11],"100",above);
    a[4]=[10.5,-10.5]; text([10.5,-10.5],"10",above);
    a[5]=[10.25,-10.75]; text([10.25,-10.75],"10",above);
    a[6]=[10.75,-10.25]; text([10.75,-10.25],"10",above);
    path(a);
    markerfill = "yellow";
    b=[];
    b[0]=[10,-10.5];  text([10,-10.5],"3.16",above);
    b[1]=[10.25,-10.25];  text([10.25,-10.25],"3.16",above);
    b[2]=[10.5,-10];  text([10.5,-10],"3.16",above);
    b[3]=[10.5,-11];  text([10.5,-11],"31.6",above);
    b[4]=[10.75,-10.75];  text([10.75,-10.75],"31.6",above);
    b[5]=[11,-10.5];  text([11,-10.5],"31.6",above);
    path(b);
    markerfill = "red";
    c=[];
    c[0]=[10,-10.25]; text([10,-10.25],"1.78",above);
    c[1]=[10.25,-10]; text([10.25,-10],"1.78",above);
    c[2]=[10.25,-11]; text([10.25,-11],"17.8",above);
    c[3]=[10.5,-10.75]; text([10.5,-10.75],"17.8",above);
    c[4]=[10.75,-10.5]; text([10.75,-10.5],"17.8",above);
    c[5]=[11,-10.25]; text([11,-10.25],"17.8",above);
    path(c);
    markerfill = "green";
    d=[];
    d[0]=[10,-10.75]; text([10,-10.75],"5.62",above);
    d[1]=[10.25,-10.5]; text([10.25,-10.5],"5.62",above);
    d[2]=[10.5,-10.25]; text([10.5,-10.25],"5.62",above);
    d[3]=[10.75,-10]; text([10.75,-10],"5.62",above);
    d[4]=[11,-10.75]; text([11,-10.75],"56.2",above);
    d[5]=[10.75,-11]; text([10.75,-11],"56.2",above);
    path(d);
    endagraph

    This is clearly still a multiplication table of sorts.  To better emphasize continuity, we can drop all of our marker points except those on the perimeter of the square, and draw marker lines :

    agraph
    width=400; height=400;
    xmin=(9.9); xmax=11.1;
    ymin=(-11.1); ymax=-9.9;
    marker = "none";
    marker = "dot";
    stroke = "none";
    markerfill = "blue";
    a=[];
    a[0]=[10,-10]; text([10,-10],"1",above);
    a[1]=[11,-11]; text([11,-11],"100",above);
    path(a);
    stroke = "blue";
    aa=[];
    aa[0]=[11,-10]; text([11,-10],"10",above);
    aa[1]=[10,-11]; text([10,-11],"10",above);
    path(aa);
    markerfill = "yellow";
    stroke = "yellow";
    b=[];
    b[0]=[10,-10.5];  text([10,-10.5],"3.16",above);
    b[1]=[10.5,-10];  text([10.5,-10],"3.16",above);
    path(b);
    bb=[];
    bb[0]=[10.5,-11];  text([10.5,-11],"31.6",above);
    bb[1]=[11,-10.5];  text([11,-10.5],"31.6",above);
    path(bb);
    markerfill = "red";
    stroke = "red";
    c=[];
    c[0]=[10,-10.25]; text([10,-10.25],"1.78",above);
    c[1]=[10.25,-10]; text([10.25,-10],"1.78",above);
    path(c);
    cc=[];
    cc[0]=[10.25,-11]; text([10.25,-11],"17.8",above);
    cc[1]=[11,-10.25]; text([11,-10.25],"17.8",above);
    path(cc);
    markerfill = "green";
    stroke = "green";
    d=[];
    d[0]=[10,-10.75]; text([10,-10.75],"5.62",above);
    d[1]=[10.75,-10]; text([10.75,-10],"5.62",above);
    path(d);
    dd=[];
    dd[0]=[11,-10.75]; text([11,-10.75],"56.2",above);
    dd[1]=[10.75,-11]; text([10.75,-11],"56.2",above);
    path(dd);
    endagraph

    These marker lines are just a few of the continuous infinity of parallel lines that form the stripes of this table.

    Let the foregoing table be a single quilt square.  We can make copies of this square, some exact, and some multiplied by various whole powers of ten, and put them together like a quilt, to form a continuous, infinite, stripy multiplication table.

    To see how this is done, change the scale a bit, and consider the following powers-of-ten stripy multiplication table :

    agraph
    width=400; height=400;
    xmin=(9.8); xmax=13.2;
    ymin=(-13.2); ymax=-9.8;
    marker = "none";
    marker = "dot";
    stroke = "none";
    markerfill = "blue";
    a=[];
    a[0]=[10,-10]; text([10,-10],"0.01",above);
    a[1]=[11,-10]; text([11,-10],"0.1",above);
    a[2]=[10,-11]; text([10,-11],"0.1",above);
    a[3]=[12,-10]; text([12,-10],"1",above);
    a[4]=[11,-11]; text([11,-11],"1",above);
    a[5]=[10,-12]; text([10,-12],"1",above);
    a[6]=[13,-10]; text([13,-10],"10",above);
    a[7]=[12,-11]; text([12,-11],"10",above);
    a[8]=[11,-12]; text([11,-12],"10",above);
    a[9]=[10,-13]; text([10,-13],"10",above);
    a[10]=[13,-11]; text([13,-11],"100",above);
    a[11]=[12,-12]; text([12,-12],"100",above);
    a[12]=[11,-13]; text([11,-13],"100",above);
    a[13]=[13,-12]; text([13,-12],"1000",above);
    a[14]=[12,-13]; text([12,-13],"1000",above);
    a[15]=[13,-13]; text([13,-13],"10000",above);
    path(a);
    endagraph
    Put a copy of the preceding "single quilt square" table in the middle, and fit appropriate other quilt squares around it in all directions, selecting the appropriate power of ten multiplier for the quilt square so that edges match.

    The result is an infinite, continuous, stripy multiplication table.

    Take a horizontal or vertical line through this infinite table.  Each point on such a line has a number associated with it.  The numbers run from arbitrarily small positive numbers at one end of the line, to arbitrarily large positive numbers at the other.  A line so marked is called a logarithmic scale.  On a logarithmic scale, the integer powers of any given positive number are evenly spaced.

    The single quilt square multiplication table devised above, if given a quarter turn anticlockwise, is apparently the original log-log plot.  For details, see the article on Lalanne's Universal Calculator in Ron Doerfler's beautiful 2010 "Graphical Computing" calendar.

    I ran into Doerfler's calendar, and was introduced to Lalanne, three or four days after coming up with and using stripy continuous multiplication tables in lectures to give my liberal arts major classes a feel for logarithmic units.  I am familiar with log-log plots, but hadn't approached this in that light.

    As my father used to say, great minds think alike, but greater minds think first.

    Nor is this the first time Doerfler and I have crossed paths mentally.  A piece of Doerfler's writing, on calculating inverse hyperbolic tangents, proved useful in a physics paper I got published in the American Journal of Physics a few years ago.  That, too, was related to logarithms.

    Tuesday, March 2, 2010

    Stripy multiplication tables

    Consider the following (somewhat contrived) stripy multiplication table:

    `\qquad\qquad\qquad[(1,100, 10000),(100,10000,1000000),(10000,1000000,100000000)]`

    It is easy to interleave new rows and new columns, to get another stripy multiplication table :

    `\qquad[(1,10,100,1000,10000),(10,100,1000,10000,100000),(100,1000,10000,100000,1000000),(1000,10000,100000,1000000,10000000),(10000,100000,1000000,10000000,100000000)]`

    Now look at this very simple table, which is a subtable of the last one :

    `\qquad\qquad\qquad[(1,10),(10,100)]`.

    Can we interleave a new row and a new column into this table, preserving the existing values, and producing a new stripy multiplication table? In other words, can we fill in the missing values in this,

    `\qquad\qquad\qquad[(1,"*",10),("*","*","*"),(10,"*",100)]`,

    to make the result a stripy proportion table? Stripiness is constancy along the diagonals :

    `\qquad\qquad\qquad[(1,u,10),(u,10,v),(10,v,100)]`.

    The proportionality condition requires e.g. that

    `\qquad\qquad\qquad1/u = u/10,`

    i.e. that `u^2 = 10,` i.e. that `u = \pm\sqrt10`. Let us choose `u = \sqrt{10}.` Then we have

    `\qquad\qquad\qquad[(1,\sqrt10,10),(\sqrt10,10,v),(10,v,100)]`.

    Looking at the subtable in the top right hand corner,

    `\qquad\qquad\qquad[(\sqrt10,10),(10,v)]`,

    we can solve for `v` :

    `\qquad\qquad\qquad v = \frac{10 xx 10}{\sqrt10},`
    `\qquad\qquad\qquad\qquad = \frac{100}{\sqrt10},`
    `\qquad\qquad\qquad\qquad = \frac{100 xx \sqrt10}{\sqrt10 xx \sqrt10},`
    `\qquad\qquad\qquad\qquad = \frac{100 xx \sqrt10}{10},`
    `\qquad\qquad\qquad\qquad = 10\sqrt10.`

    So now we have a complete stripy multiplication table :

    `\qquad\qquad\qquad[(1,\sqrt10,10),(\sqrt10,10,10\sqrt10),(10,10\sqrt10,100)]`.

    This can be more revealingly presented by writing all the entries as powers of `10`:

    `\qquad\qquad\qquad[(10^0,10^{1/2},10^1),(10^{1/2},10^1,10^{1 1/2}),(10^1,10^{1 1/2},10^2)]`,

    or if we write the exponents fully in decimal,

    `\qquad\qquad\qquad[(10^0,10^{0.5},10^1),(10^{0.5},10^1,10^{1.5}),(10^1,10^{1.5},10^2)]`.

    This illustrates a general truth. A stripy proportion table is made by raising a single number (i.e. a base) to powers (exponents) coming from a stripy glide table. Here, for instance, we can pick `10` as the base, and

    `\qquad\qquad\qquad[(0,0.5,1),(0.5,1,1.5),(1,1.5,2)]`

    as the table of exponents.

    The choice is not unique, however.  For instance, we could get the same result by using `\sqrt10` or `10^{0.5}` for the base, and

    `\qquad\qquad\qquad[(0,1,2),(1,2,3),(2,3,4)]`

    for the table of exponents.  Either way, we the result is the multiplication table

    `\qquad\qquad\qquad[(10^0,10^{0.5},10^1),(10^{0.5},10^1,10^{1.5}),(10^1,10^{1.5},10^2)]`.

    Let us rewrite this in decimals, rounding to three significant figures :

    `\qquad\qquad\qquad[(1,3.16,10),(3.16,10,31.6),(10,31.6,100)]`.

    When working with stripy multiplication tables, lets us adopt the understanding that rounded values are shorthand for the exact values.

    We can fill in new rows between these.  Stripiness constrains what is possible :

    `\qquad\qquad\qquad[(1,a,3.16,b,10),(a,3.16,b,10,c),(3.16,b,10,c,31.6),(b,10,c,31.6,d),(10,c,31.6,d,100)]`.

    Consider, now, just the first two columns :

    `\qquad\qquad\qquad[(1,a),(a,3.16),(3.16,b),(b,10),(10,c)]`.

    By stripiness, the second column is essentially the first column, displaced upward one place.  Applying the proportionality condition to the first two rows, we have :

    `\qquad\qquad\qquad1/a = a/3.16`.

    Then `a^2 = 3.16` and `a = \pm1.78`, where we are using `3.16` as shorthand for `\sqrt{10}` and `1.78` as shorthand for `\sqrt\sqrt10`.  Selecting the positive sign, `a = 1.78`.

    Now, considering the second and third rows, we have

    `\qquad\qquad\qquad1.78/3.16 = 3.16/b`.

    This determines `b` fully, including its sign.  Alternatively, we can look at the third and fourth rows, taking

    `\qquad\qquad\qquad3.16/b = b/10`,

    and this determines that the magnitude of `b` is `\sqrt{3.16 xx 10} = 5.62`, i.e. that it is the geometric mean of `3.16` and `10`.

    Looking back, we see that with the choice of positive sign, `a` is also the geometric mean of the `1` and `3.16`, the quantities above and below it.

    `\qquad\qquad\qquad[(1,1.78),(1.78,3.16),(3.16,5.62),(5.62,10),(10,c)]`.

    The last value can be conveniently found from applying the proportionality condition to the first and last rows, i.e. to the four corners of the preceding table,

    `\qquad\qquad\qquad1/10 = 1.78/c`,

    so that `c = 10 xx 1.78 = 17.8`, and the table is

    `\qquad\qquad\qquad[(1,1.78),(1.78,3.16),(3.16,5.62),(5.62,10),(10,17.8)]`.

    By stripiness, we can generate most of the third column,

    `\qquad\qquad\qquad[(1,1.78,3.16),(1.78,3.16,5.62),(3.16,5.62,10),(5.62,10,17.8),(10,17.8,"d")]`.

    The proportionality condition on the four corners of this table is

    `\qquad\qquad\qquad1/10 = 3.16/d`,

    whence `d = 10 xx 3.16 = 31.6,` and the table becomes

    `\qquad\qquad\qquad[(1,1.78,3.16),(1.78,3.16,5.62),(3.16,5.62,10),(5.62,10,17.8),(10,17.8,31.6)]`.

    We can find the remaining columns in the same way, getting, to three significant digits,

    `\qquad\qquad\qquad[(1,1.78,3.16,5.62,10),(1.78,3.16,5.62,10,17.8),(3.16,5.62,10,17.8,31.6),(5.62,10,17.8,31.6,56.2),(10,17.8,31.6,56.2,100)]`.

    As before, we can express this as

    `\qquad\qquad\qquad[(10^0,10^0.25,10^0.5,10^0.75,10^1),(10^0.25,10^0.5,10^0.75,10^1,10^1.25),(10^0.5,10^0.75,10^1,10^1.25,10^1.5),(10^0.75,10^1,10^1.25,10^1.5,10^1.75),(10^1,10^1.25,10^1.5,10^1.75,10^2)]`.

    i.e, as `10` to the power of exponents from the stripy glide table

    `\qquad\qquad\qquad[(0,0.25,0.5,0.75,1),(0.25,0.5,0.75,1,1.25),(0.5,0.75,1,1.25,1.5),(0.75,1,1.25,1.5,1.75),(1,1.25,1.5,1.75,2)]`.

    Using stripiness and proportionality, the proportion table

    `\qquad\qquad\qquad[(1,1.78,3.16,5.62,10),(1.78,3.16,5.62,10,17.8),(3.16,5.62,10,17.8,31.6),(5.62,10,17.8,31.6,56.2),(10,17.8,31.6,56.2,100)]`

    can be extended infinitely in all directions. Here's a start :

    `\qquad[(0.1,0.178,0.316,0.562,1,1.78,3.16,5.62,10),(0.178,0.316,0.562,1,1.78,3.16,5.62,10,17.8),(0.316,0.562,1,1.78,3.16,5.62,10,17.8,31.6),(0.562,1,1.78,3.16,5.62,10,17.8,31.6,56.2),(1,1.78,3.16,5.62,10,17.8,31.6,56.2,100),(1.78,3.16,5.62,10,17.8,31.6,56.2,100,178.),(3.16,5.62,10,17.8,31.6,56.2,100,178.,316.),(5.62,10,17.8,31.6,56.2,100,178.,316.,562.),(10,17.8,31.6,56.2,100,178.,316.,562.,1000)]`.

    This infinite multiplication table can be built from very little.

    First, we note that every row and every column consists of the same infinite-in-both-directions sequence of values,

    `\qquad\ldots,0.316,0.562,1,1.78,3.16,5.62,10,17.8,31.6,\ldots`

    Second, we note that this is what is classically called a geometric progression, a sequence of numbers with a common ratio.  Each number is `10^0.25 \approx 1.78` times the one that precedes it.  Since `1` is in this sequence, the sequence consists of all numbers `10^{n/4}`, with `n` an integer.

    Third, we note that, up to round factors of ten, there are only four distinct numbers here, even in the infinite version of the table.  To three significant digits, they are : `1, 1.78, 3.16, 5.62`.  Every number in the table consists of one of these digit strings, differing only where the decimal point is placed.

    To have this infinite table, to three digit accuracy, at one's mental service, all one need do is remember this sequence of numbers and what they mean :

    `\qquad\qquad\qquad[(\ulx,\ul{10^x}),(0,1),(1//4,1.78),(1//2,3.16),(3//4,5.62),(1,10)]`.

    To find, for instance, `56.2 xx 3.16`, one reasons

    `\qquad\qquad\qquad 56.2 xx 3.16 = 10 xx 5.62 xx 3.16,`
    `\qquad\qquad\qquad\qquad = 10^1 xx 10^\frac{3}{4} xx 10^\frac{1}{2},`
    `\qquad\qquad\qquad\qquad = 10^(1 + 3/4 + 1/2),`
    `\qquad\qquad\qquad\qquad = 10^(2 + 1/4),`
    `\qquad\qquad\qquad\qquad = 10^2 xx 10^{1/4},`
    `\qquad\qquad\qquad\qquad = 100 xx 1.78,`
    `\qquad\qquad\qquad\qquad = 178.`

    Why is the standard multiplication table harder to learn than the usual addition tables?

    A standard times table, in proportion table form, looks like this :

    `\qquad\qquad\qquad[(1,2,3,4,5,6,7,8,9,10),(2,4,6,8,10,12,14,16,18,20),(3,6,9,12,15,18,21,24,27,30),(4,8,12,16,20,24,28,32,36,40),(5,10,15,20,25,30,35,40,45,50),(6,12,18,24,30,36,42,48,54,60),(7,14,21,28,35,42,49,56,63,70),(8,16,24,32,40,48,56,64,72,80),(9,18,27,36,45,54,63,72,81,90),(10,20,30,40,50,60,70,80,90,100)]`
     
    A standard addition table (not a proportion table of course, but rather a glide table,) looks like this :

    `\qquad\qquad\qquad[(0,1,2,3,4,5,6,7,8,9),(1,2,3,4,5,6,7,8,9,10),(2,3,4,5,6,7,8,9,10,11),(3,4,5,6,7,8,9,10,11,12),(4,5,6,7,8,9,10,11,12,13),(5,6,7,8,9,10,11,12,13,14),(6,7,8,9,10,11,12,13,14,15),(7,8,9,10,11,12,13,14,15,16),(8,9,10,11,12,13,14,15,16,17),(9,10,11,12,13,14,15,16,17,18)]`

    A glide table is to addition and subtraction what a proportion table is to multiplication and division.

    In a glide table, all the rows, and equivalently all the columns, differ by fixed amounts.

    The way to reconstruct a value at one corner of a box (`2 xx 2` subtable) also differs, but in an obvious way :  to find the value at one corner, one adds the values at the neighboring corners and subtracts the value at the opposite corner.

    So now we have presented two tables, one for multiplication, and the other for addition.  It is reasonably common for people to not remember all multiplications in the times table, but rather rarer for them not to know all that is in the addition table.

    There are a number of reasons for this, of course.  The numbers in the multiplication table are mostly larger, for instance.

    Two of the reasons, however, for the relative ease of learning the addition table can help us construct multiplication tables that are easy, for what they do:
    • the standard addition table, even though it is the same size, has fewer distinct values than the standard, multiplication table, and
    • the standard addition table has a simpler structure---it is stripy.
    Looking at the standard addition table, we see stripes of common values.  It is possible to make multiplication tables that are stripy.  Consider, for instance, this one :

    `\qquad\qquad\qquad[(1,2,4,8,16,32),(2,4,8,16,32,64),(4,8,16,32,64,128),(8,16,32,64,128,256),(16,32,64,128,256,512),(32,64,128,256,512,1024)]`

    In the next posting, we shall begin constructing some useful stripy multiplication tables.

    Thursday, February 25, 2010

    Long division taken apart, continued

    Now that we have taken long division apart, in the last posting, and made a multiplication table for the divisor `21`, in the posting before that, we are ready to look at the standard long division algorithm, with Jakow Trachtenberg's trick.

    We are dividing `1543` by `21`, using the multiplication table

    `\qquad\qquad\qquad[(0, 0),(1, 21),(2,42),(3,63),(4,84),(5,105),(6,126),(7,147),(8,168),(9,189)]`.

    Start by writing

    `\qquad\qquad\qquad\qquad\quad"****."`
    `\qquad\qquad\qquad 21 )\bar1543.`

    From the table, see that no whole `21`s go into `1` or into `15`, but that `7` whole `21`s, but not `8`, go into `154` :

    `\qquad\qquad\qquad\qquad\qquad\quad7"*."`
    `\qquad\qquad\qquad 21 )\bar1543.`
    `\qquad\qquad\qquad\qquad\quad147 .`

    Subtract `1470` from `1543` leaving `73`.

    `\qquad\qquad\qquad\qquad\qquad\quad7"*."`
    `\qquad\qquad\qquad 21 )\bar1543.`
    `\qquad\qquad\qquad\qquad\quad\ul1470.`
    `\qquad\qquad\qquad\qquad\qquad\quad73.`

    From the table, again, `3` whole `21`s, i.e. `63`, go into `73`, leaving `10`.

    `\qquad\qquad\qquad\qquad\qquad\quad73.`
    `\qquad\qquad\qquad 21 )\bar1543.`
    `\qquad\qquad\qquad\qquad\quad\ul1470`
    `\qquad\qquad\qquad\qquad\qquad\quad73.`
    `\qquad\qquad\qquad\qquad\qquad\quad\ul63.`
    `\qquad\qquad\qquad\qquad\qquad\quad10.`

    This is the stopping point for divmod division, so that `1543 :- 21 = 73 " remainder " 10.`

    For decimal division, one continues `21`s into `100` go `4` times, i.e. `84` leaving `16`.

    `\qquad\qquad\qquad\qquad\qquad\quad73.`
    `\qquad\qquad\qquad 21 )\bar1543.`
    `\qquad\qquad\qquad\qquad\quad\ul1470`
    `\qquad\qquad\qquad\qquad\qquad\quad73.`
    `\qquad\qquad\qquad\qquad\qquad\quad\ul63.`
    `\qquad\qquad\qquad\qquad\qquad\quad10.0`
    `\qquad\qquad\qquad\qquad\qquad\qquad\ul8.4`
    `\qquad\qquad\qquad\qquad\qquad\qquad1.6`

    This continues until one has reached the desired degree of accuracy.

    Long division taken apart

    When we divide, we are trying to find out how many times the divisor (e.g. 21) goes into the dividend (e.g. 1543).

    We could just repeatedly subtract, keeping a tally of the number of times we have subtracted, stopping when further subtraction would give a negative result.  At least, that is how we could do divmod division.

    Keeping such a tally would be tedious, however.  It is better to subtract large but convenient multiples of the divisor, than smaller multiples, keeping tally of these separately as we go.

    In our usual decimal system of numeration, powers of ten are particularly convenient multipliers.

    In 1543, the highest nonzero column is the thousands column.  We can therefore try subtracting thousands of `21`s.  We could not subtract `21` thousand even once from `1` thousand and anything without the result being negative.  So we need `0` thousands of `21`s, and we still have `1` thousand and something.

    Next, we try hundreds of `21`s.  Again, we cannot subtract even `21` hundreds even once from `15` hundred and something, without the result being negative.  So we need `0` hundreds of `21`s, and we still have `15` hundred and something.

    Next, we try tens of `21`s.  We can subtract `21` tens from `154` tens and something.  Indeed, we can subtract `7` times, a total of `147` tens, without getting negative result.  So now we have that `154` tens and `3` is the same as `7` lots of `21` tens, and then `7` tens and `3`.

    Next we try whole `21`s.  We can subtract `21` from `73` just `3` times without going negative.  This subtracts a total of `63` from `73`, leaving `10`.

    So now we have that `1543` is the same as `7` lots of `21` tens, and `3` lots of `21` ones, and a further `10`.

    This can instead be understood as `70` lots of `21`, and `3` lots of `21`, and `10` more.  This in turn is `73 xx 21` and `10`.  i.e.

    `\qquad\qquad\qquad 1543 = (73 xx 21) + 10.`

    If we are doing divmod division, we can stop :

    `\qquad\qquad\qquad 1543 -: 21 = 73" remainder "10.`

    But if, instead of a remainder, we want the quotient to have a fractional part expressed as a decimal, then we keep going.

    We have `10` that still needs to be divided by `21`.  So now we try subtracting tenths of `21`.  `10` is `100` tenths.  We can subtract `4` lots of tenths of `21`, i.e. `84` tenths, from `100` tenths, leaving `16` tenths.

    Next, we try subtracting hundredths of `21` from `160` hundredths.  `7` hundredths of `21` is `147` hundredths, which when subtracted from `160` hundredths leaves `13` hundredths.

    Stopping at this point, we find that

    `\qquad\qquad\qquad 1543 = (73.47 xx 21) + 0.13`,

    which we can write

    `\qquad\qquad\qquad 1543 -: 21 = 73.47" remainder "0.13`.

    The preceding discussion has been rather lengthy--such work is usually set out in a much more compressed format.  Unfortunately, long division seems to have been taught procedurally without adequate preparation, so that the elided computational form entrains elided thinking.  Even among the few in these calculator-infested days who can still actually do long division, a substantial fraction can give no convincing account of why the standard long division algorithm works.

    Building ad hoc multiplication tables

    Proportion tables are sometimes useful for doing long division. 

    For many people, the most difficult part of that standard long division algorithm is estimating which multiple of the divisor to subtract.  Jakow Trachtenberg taught a simple trick for avoiding this difficulty.

    In the next posting, we are going to divide 1543 by 21, using the standard long division algorithm and Trachtenberg's trick.

    The first step is to invest some time making a table of multiples of `21`, up to the `9 xx 21`.  The `0` and `1` rows are obvious :

    `\qquad\qquad\qquad[(0, 0),(1, 21)]`.

    The `2` row can be found by doubling the second row :

    `\qquad\qquad\qquad[(0, 0),(1, 21),(2,42)]`.

    The `3` row can be found by adding the `1` row and the `2` row :

    `\qquad\qquad\qquad[(0, 0),(1, 21),(2,42),(3,63)]`.

    The `4` row can be found either by adding the `1` row to the `3` row, or else by doubling the `2` row.  One picks whichever is more convenient :

    `\qquad\qquad\qquad[(0, 0),(1, 21),(2,42),(3,63),(4,84)]`.

    The `5` row can be found either by adding the `2` row and the `3` row, or else by adding the `1` row and the `5` row.  Again, one picks whichever is more convenient :

    `\qquad\qquad\qquad[(0, 0),(1, 21),(2,42),(3,63),(4,84),(5,105)]`.

    One continues in this way, constructing the next row opportunistically, until at last one has :

    `\qquad\qquad\qquad[(0, 0),(1, 21),(2,42),(3,63),(4,84),(5,105),(6,126),(7,147),(8,168),(9,189)]`.

    This can be checked by casting out nines, if one knows how to do that.  (If not, it needs to be the subject of yet another post.)

    Now we are ready divide anything by `21`.

    `\qquad\qquad\qquad[(0, 0,(0)),(1, 21,(3)),(2,42,(6)),(3,63,(0)),(4,84,(3)),(5,105,(6)),(6,126,(0)),(7,147,(3)),(8,168,(6)),(9,189,(0))]`.

    This checks out, so we can rely on the table we have made.