Friday, March 5, 2010

Pounds, shillings, pence as a system of logarithms

To the memory of Orson Pratt, 1811-1881. [Professor of Mathematics in the University of Nauvoo, and LDS (Mormon) apostle. Pratt presided over the LDS church's British Mission at a time when there were twice as many LDS in Britain as in the United States, so he would certainly have been familiar with the pounds, shillings, pence system of currency, in which 1 pound is worth 240 pence. A couple of decades later, Pratt, apparently at his own request, was assigned by Brigham Young to redivide the Book of Mormon into chapters and verses, a division which stands today: a canonical and somewhat lengthy colophon known as the Title Page, and 239 chapters, so 240 chapter-length divisions in all. At this remove, it is not possible to determine whether this coincidence of numbers was intentional, unconscious, or happenstance. Nevertheless, this system would not have been devised by this author without Pratt's subdivision, because it arose originally in connection with an effort to devise a mnemotechnical scheme for the chapter-by-chapter content of the Book of Mormon.]

The purpose of this posting is to describe a mixed system of logarithmic units.

By the end of the posting, with just the use of a table of 19 (easily memorized) values, you will be able to find arbitrary powers and roots of arbitrary numbers, generally to within one percent accuracy.

This system could, in principle, have been invented a couple of hundred years ago.  It is contructed mostly by stitching together a large variety of preexisting pieces: decades, decibels, R-series prefered numbers, pounds-shillings-pence money, order-of-magnitude arguments, percentage tweaking calculations.

My particular contribution here is putting together a mixed system of logarithmic units.  I have never seen that done anywhere else.  The system particularly exploits the numerical coincidence that

`qquadqquadqquad10^{1//240} \approx 1.01`,

  • `10` is the base of the decimal number system we use, 
  • `1.01` is the factor corresponding to a tweak of one percent, (percent being the usual unit of tweaking arguments,) and 
  • `240` is the number of pence in a pound, a highly composite number.

An earlier posting defined the (well-known) logarithmic units decade, neper, and octave as `"lg"(10)`, `"lg"("e")`, and `"lg"(2)`, respectively.  All logarithmic units in common use are at most simple rational multiples of one of these three units.  So, there are decadic units, neperic units, and octavic (or binary) units.

First, let's define three decadic units, and then show why they are particularly useful as a system.

These logarithmic units are the decade (dec), the decibel (dB), and the point (pt). Let's defer discussion of the merits of these particular names.

The old British Imperial currency, its lineage dating back past Charlemagne, had a pound equal to twenty shillings, and a shilling equal to twelve pence.

These logarithmic units share the same arithmetic.  The decade is twenty decibels, and the decibel is twelve points.  Thus
  • `1" decade" = "lg"(10)`,
  • `1" decibel" = 1/20 "lg"(10) = "lg"(10^{1//20}) \approx "lg"(1.12)`, and
  • `1" point" = 1/240 "lg"(10) = "lg"(10^{1//240}) \approx "lg"(1.01)`.
The decade is the multiplying strength of (a factor of) ten.

Arguments that use round powers of ten are a commonplace in technical disciplines.  They are known as order-of-magnitude arguments, and people use expressions like "three orders of magnitude" to mean "very roughly a factor of a thousand".  The decade is a precise order of magnitude.  Order of magnitude arguments are, at root, logarithmic arguments.

The common logarithm, the one found by the 'log' key on a calculator, is the number of decades in the multiplying strength of a number.

The decibel is the multiplying strength of the twentieth root of ten, which is about `1.12`.  Integer powers of this, i.e. numbers of the form `10^{n//20}` for `n` an integer, constitute the R20 series of prefered numbers, as now maintained in an international standard by the ISO.  The 'R' in R20 honours the French engineer Charles Renard, the inventor of this system.  The `20` tells us that we go from one power of ten to the next in twenty steps.  These steps---this is Renard's invention---go up in constant proportion.

All of the values in stripy multiplication table


come from what could reasonably be called the R4 series of prefered numbers.  Interposing rows and columns, we can build a similar table for the R20 series.  The R20 values between `1` and `10`, rounded to three significant figures, are the values in the second column.  Their logarithms, expressed in decibels, appear in the first column ":

 `\qquad\qquad\qquad{:(0" dB", \qquad1),(1" dB", \qquad1.12),(2" dB", \qquad1.26),(3" dB", \qquad1.41),(4" dB", \qquad1.58),(5" dB", \qquad1.78),(6" dB", \qquad2.00),(7" dB", \qquad2.24),(8" dB", \qquad2.51),(9" dB", \qquad2.82),(10" dB", \qquad3.16),(11" dB", \qquad3.55),(12" dB", \qquad3.98),(13" dB", \qquad4.47),(14" dB", \qquad5.01),(15" dB", \qquad5.62),(16" dB", \qquad6.31),(17" dB", \qquad7.08),(18" dB", \qquad7.94),(19" dB", \qquad8.91),(20" dB", \qquad10):}`

Put another way, if `n` is the numerical part of the logarithm in the first column, then the number in the second column is `10^{n//20}`.

In the seventh edition of the SI Handbook, published by the BIPM, the bel was defined as half of what we have been calling a decade.  The decibel is a tenth of this, and so it is a twentieth of a decade.  The eighth edition of the SI Handbook removed this definition of the bel, but did not supersede it.

The R20 values form a bridge between the two other kinds of units.  Also, since, to three significant digits, the number 2 is an R20 value, the octave, `"lg"(2)`, is approximately a round number of decibels.  This gives us a tie between octavic units and decadic units.

The point is the multiplying strength of the 240th root of ten, which is about 1.01.  A change of one point is roughly equivalent to a change of one percent.  It is also roughly equivalent to a change of one centineper, which gives a tie to neperic units.

Percentage tweaking arguments are widely used in technical disciplines.  If a quantity goes up by three percent, say, then its square goes up by about six percent.  If the length of a rectangle goes up five percent, while its width goes up by two percent, than its area increases by about seven percent.  Addition of small percentage tweaks is used to do the work of multiplication---this is the hallmark of logarithms.  Small percentage tweaks used in this way are being used as approximate logarithms.

This mixed system of logarithmic units is particularly well suited to calculation of approximate logarithms.

As an example, let's calculate the logarithm of `72900`.  First, we rewrite this in reverse scientific notation, i.e. we factor it as a whole power of ten multiplied by a number between `1` and `10`:

`\qquad\qquad\qquad 72900 = 10^4 xx 7.29`.

Next, we break the second factor into two factors.  The first factor is selected from the R20 values in the table.  Since `7.29` is between `7.08` and `7.94`, we will pick one of these values.  We usually pick the lower table value, unless our value is within about two percent of the higher value.  Then

`\qquad\qquad\qquad 72900 = 10^4 xx 7.08 xx 7.29/7.08`.

We now calculate the ratio `7.29//7.08`.  This could be done by long division, but we prefer instead the folowing :

`\qquad\qquad 7.29/7.08 = 729/708 = {708 + 21}/708 = 1 + 21/708.`

To get three or four digits of accuracy in the sum `1 + 21//708`, we need only one or two digits of accuracy in `21//708`.  We can therefore afford to round the denominator, so that

`\qquad\qquad\qquad 21/708 \approx 21/700 = 3/100`.

Then `1 + 21//708 \approx 1.03`.

The same conclusion can be reached by making the proportion table :

 `\qquad\qquad\qquad{:(708, 100%),(71, 10%),(7, 1%),(21, ?):}.`

The first row always consists of the target divisor or denominator, here 708, and 100%.  One creates the second row by dividing through by ten or another simple divisor, until the value in the first column is comparable to or smaller than the target dividend or numerator, here 21.  Numbers in the first column are usually rounded to the same number of decimal places (here zero) as in the first row.  If the target numerator is a small multiple of the target numerator---here `21 = 3 xx 7,` this gives us what we are looking for, i.e. the desired percentage is `3 xx 1% = 3%.`

(We don't want a high multiple, especially if rounding has been severe.  If, for instance, the numerator had been 51 instead of 21, then we would created yet another row by taking three times the `[7,1%]` row from the `[71,10%]` row and we would have had `[50,7%],` so that `51//71 ~~ 0.07.`)

Either way, here, we get 

`\qquad\qquad\qquad 72900 = 10^4 xx 7.08 xx 1.03`.

From the table, we can rewrite `7.08 = 1.12^17`.  The binomial theorem gives us that `(1 + x)^n \approx 1 + n x`, and so `1.03 \approx 1.01^3`.  So

`\qquad\qquad\qquad 72900 \approx 10^4 xx 1.12^17 xx 1.01^3`.


`\qquad\qquad\qquad "lg"(72900) \approx "lg"(10^4 xx 1.12^17 xx 1.01^3`)`,
`\qquad\qquad\qquad\qquad = "lg"(10^4) + "lg"(1.12^17) + "lg"(1.01^3`)`,
`\qquad\qquad\qquad\qquad = 4\cdot"lg"(10) + 17\cdot"lg"(1.12) + 3\cdot"lg"(1.01)`,
`\qquad\qquad\qquad\qquad = 4" dec" + 17" dB" + 3" pt"`.

Compound arithmetic with mixed units can be used for adding or subtracting the logarithms of different numbers, and even for multiplying or dividing by simple integers.  These are the processes one needs when one is using logarithms to multiply, divide, or take simple roots or powers.

For more complicated powers, and often in other calculations, it more convenient to work in a consistent units.  We can rewrite this mixed form using wiggle notation, and use that to calculate values in one or other of the given units, so that

`\qquad\qquad\qquad "lg"(72900) \approx 4;_{20}17_{12}3" dec"`,
`\qquad\qquad\qquad\qquad = 4_{20}17;_{12}3" dB"`,
`\qquad\qquad\qquad \qquad = 4_{20}17_{12}3;" pt"`.

For instance,

`\qquad\qquad\qquad 4;_{20}17_{12}3 = 4 +\frac{17 xx 12 + 3}{20 xx 12}`,

`\qquad\qquad\qquad\qquad = 4 +207/240`,
`\qquad\qquad\qquad\qquad = 4 +\frac{207 xx 1.04}{240 xx 1.04}`,
`\qquad\qquad\qquad\qquad \approx 4 + \frac{215}{250}`,
`\qquad\qquad\qquad\qquad = 4 +\frac{860}{1000}`,
`\qquad\qquad\qquad\qquad = 4.86`.

i.e. `"lg"(72900) \approx 4.86" dec"`, or `\log_{10}(72900) \approx 4.86`.  This compares well with the more accurate value of `4.8627275`.

It is usually more convenient to work in points.  The conversion doesn't require further division, at least here, and each point corresponds to a one percent difference in the answer, so it is easier to make decisions about acceptable error.

`\qquad\qquad\qquad "lg"(72900) \approx 4_{20}17_{12}3;" pt"`,
`\qquad\qquad\qquad = (80 + 17)_{12}3;" pt"`,
`\qquad\qquad\qquad = 97 xx 12 + 3" pt"`,
`\qquad\qquad\qquad = 1164 + 3" pt"`,
`\qquad\qquad\qquad = 1167" pt"`.

Suppose we wanted to find `72900^{3//7}`.

The logarithm of `72900^{3//7}` is `3//7` of the logarithm of `72900`, i.e. about `3//7` of `1167` points.  `1167 xx 3 = 3501`.  `3501 -: 7 \approx 500.1`.  So the logarithm of our answer is aboout `500.1" pt"`.

Reverting this into mixed units, we use divmod division, first by 12, and then by 20.

`\qquad\qquad\qquad 500.1 -: 12 = 41;_{12}8.1`, and

`\qquad\qquad\qquad 41 -: 20 = 2;_{20}1`,

so that

 `\qquad\qquad\qquad 500.1 = 2_{20}1_{12}8.1`,


`\qquad\qquad\qquad "lg"(72900^{3/7}) \approx 2" dec" + 1" dB" + 8.1" pt"`.


`\qquad\qquad\qquad 72900^{3/7} \approx 10^2 xx 1.12 xx 1.081`,
`\qquad\qquad\qquad\qquad = 121.`,

which compares well with the more exact value `121.346`, especially considering that table values such as `1.12` have already been rounded to three significant figures.

Thursday, March 4, 2010

Power law characterisation of the generic logarithm

As in the last posting, we begin by asserting the existence of a function from the positive reals onto a set `L`,

`\qquad\qquad\qquad "lg":RR^+ \rightarrow L`.

Also, as stated in the last posting, "the log of a product is the sum of the logs of the factors" is not the only way to characterise the generic logarithm.

We can instead simply assert the end result of the last posting, and let that be our entire starting condition.

That is, for all positive real `x` and all real `p`, we assert that

`\qquad\qquad\qquad "lg"(x^p) = p\cdot"lg"(x).`

This defines multiplication of quantities in `L` by arbitrary real numbers.  Let us call this, with some degree of anticipation, the "scalar multiplication" condition.  As before, the existence of models ensures the consistency of the definition.

Consider now arbitrary positive real numbers `u` and `v`.  Then for arbitrary positive real `x \ne 1`, we can find `p` and `q` such that `u = x^p` and `v = x^q`.  Then

`\qquad\qquad\qquad "lg"(u v) = "lg"(x^p x^q)`,
`\qquad\qquad\qquad\qquad = "lg"(x^{p+q})`,
`\qquad\qquad\qquad\qquad = (p+q)\cdot"lg"(x)`,
`\qquad\qquad\qquad\qquad = p\cdot"lg"(x) + q\cdot"lg"(x)`,
`\qquad\qquad\qquad\qquad = "lg"(x^p) + "lg"(x^q)`,
`\qquad\qquad\qquad\qquad = "lg"(u) + "lg"(v)`.

and we have established the "the log of a product is the sum of the logs of the factors" condition with which we began the last posting. 

From this we could derive all subsequent results just as we did there---but that would be wasteful, as most of those results are simply instances of the scalar multiplication condition.

We can also use the scalar multiplication condition to define division in `L`, at least for `x \ne 1` (with the consequence that `"lg"(x) \ne 0)`.  In that case, we have

`\qquad\qquad\qquad \frac{"lg"(x^p)}{"lg"(x)} = p.`

Since, given any positive real `x` and `y`, we can find a unique real number `p` such that `y = x^p`, we can divide any quantity in `L` by any nonzero quantity in `L`.

Additive characterisation of the generic logarithm

At this point, let's define the generic logarithm a little more carefully.  The generic logarithm is a function from the positive real numbers onto a set `L`,

`\qquad\qquad\qquad "lg": RR^+ \rightarrow L,`

satisfying certain conditions.  We have some choice as to the conditions we use.

One possibility is to require that, for all positive real numbers `x` and `y`,

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

where this defines the addition on the right hand side.  This is the "the log of a product is the sum of the logs of the factors" condition.  (We shall need another condition eventually, but let's not introduce it until the need is clear.)

Then it is equally true that

`\qquad\qquad\qquad "lg"(w z) = "lg"(w) + "lg"(z)`.

Letting `w = x y` and substituting,

`\qquad\qquad\qquad "lg"(x y z) = "lg"(x y) + "lg"(z)`,
`\qquad\qquad\qquad\qquad = "lg"(x) + "lg"(y) + "lg"(z)`,

and we have the rather obvious-looking result that 

`\qquad\qquad\qquad "lg"(x y z) = "lg"(x) + "lg"(y) + "lg"(z)`,

By repeating this argument, we can extend it to finite products of any length.

For `n` a counting number, we can break the logarithm of `n` factors of positive real `x` into `n` copies of the logarithm of `x` :

`\qquad\qquad\qquad "lg"(x^n) = "lg"(x\cdotx\cdotxcdot\cdots\cdotx)`,
`\qquad\qquad\qquad\qquad = "lg"(x) + "lg"(x) + \cdots + "lg"(x)`,
`\qquad\qquad\qquad\qquad = n\cdot"lg"(x)`.

The last two lines define multiplication of quantities in `L` by counting numbers.

Substituting `y = 1` in `"lg"(x y) = "lg"(x) + "lg"(y)`,  we get

`\qquad\qquad\qquad"lg"(x 1) = "lg"(x) + "lg"(1)`,


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

Subtracting the quantity `"lg"(x)` from each side and rearranging, we have that

`\qquad\qquad\qquad "lg"(1) = 0`.

This is useful in its own right.

Now `0` is the number (or quantity) that does nothing when you add it.  `1` is the number that does nothing when you multiply it.  For any positive real number `x`, multiplying by no factors of `x` is the same as multiplying by `1`, i.e.

`\qquad\qquad\qquad x^0 = 1`.

So if `"lg"(1) = 0`, then

`\qquad\qquad\qquad "lg"(x^0) = 0 = 0\cdot"lg"(x)`,

since `0` times any quantity is still `0`.

We have therefore established that

`\qquad\qquad\qquad "lg"(x^n) = n\cdot"lg"(x)`

is true not only for `n` a counting number, but also when `n = 0`.

Now let `y = 1//x` in `"lg"(x y) = "lg"(x) + "lg"(y)`. We can do this, because if `x` is positive real, so is `1//x`.  Then

`\qquad\qquad\qquad"lg"(x\cdot1/x) = "lg"(x) + "lg"(1/x)`.

Since `x\cdot1//x = 1` and `"lg"(1) = 0`

`\qquad\qquad\qquad 0 = "lg"(x) + "lg"(1/x)`.

The astute reader will notice that this defines a suitably behaved `0` in `L`.

Subtracting`"lg"(x)` from each side and rearranging, we get that

`\qquad\qquad\qquad "lg"(1/x)= -"lg"(x)`,

 which can also be written

`\qquad\qquad\qquad "lg"(x^{-1})= -1\cdot"lg"(x)`.

This, too, is a definition---it tells us what negation means in `L`.

So now we have established that

`\qquad\qquad\qquad "lg"(x^n) = n\cdot"lg"(x)`

also holds when `n = -1`.

We can find the logarithm of a product of a counting number `m` copies of `x^{-1}` as we did for multiple copies of `x` :

`\qquad\qquad\qquad "lg"((x^{-1})^m) = "lg"((x^{-1})\cdot(x^{-1})\cdot(x^{-1})cdot\cdots\cdot(x^{-1}))`,
`\qquad\qquad\qquad\qquad = "lg"((x^{-1})) + "lg"((x^{-1})) + \cdots + "lg"((x^{-1}))`,
`\qquad\qquad\qquad\qquad = m\cdot"lg"((x^{-1}))`.

Then, since "lg"(x^{-1})= -1\cdot"lg"(x)`, we have that

`\qquad\qquad\qquad "lg"((x^{-1})^m) = m\cdot(-1\cdot"lg"(x))`,
`\qquad\qquad\qquad "lg"((x^{-1})^m) = -m\cdot"lg"(x)`.

So now, setting `n = -m`, we have established that 

`\qquad\qquad\qquad "lg"(x^n) = n\cdot"lg"(x)`

for any integer `n`.  i.e., we can always move an integer power outside the logarithm as a multiplier.

Now let `p` be any rational number, which we write as `p = r/s`, where `s` is a counting number (and therefore not zero), and `r` is an integer.   Let `y = x^p = x^{r/s}`.  Then, raising this to the power of `s`, we find that

`\qquad\qquad\qquad y^s = x^r`,

and so

`\qquad\qquad\qquad "lg"(y^s) = "lg"(x^r)`,

Since `r` and `s` are both integers, we know we can move the powers outside the logarithms to get

`\qquad\qquad\qquad s\cdot"lg"(y) = r\cdot"lg"(x)`.

We now divide both sides by `s`---we know `s` is nonzero---and write

`\qquad\qquad\qquad "lg"(y) =  {r/s}\cdot"lg"(x)`,


`\qquad\qquad\qquad "lg"(x^p) = p\cdot"lg"(x)`.

This, again, is a definition.  It tells us what it means to multiply a quantity in `L` by a rational number.  But it also allows us to assert that

`\qquad\qquad\qquad "lg"(x^n) = n\cdot"lg"(x)`

is true for any rational number `n`, not just integers.

It is reasonable to hope that this would be true for any real `n`, not just rationals.  Practical uses of mathematics should be insensitive to whether a number is rational or not.

The various ways to ensure reasonable behaviour amount to various assertions of that `lg` is a continuous function, i.e. that numbers that are close in `RR+` have logarithms that are close in `L`. 

The simplest way is to ensure that we get what we want is simply to assert that

`\qquad\qquad\qquad "lg"(x^n) = n\cdot"lg"(x)`

is true for all real numbers `n`, not just rational `n`.  One needs to establish that no contradictions arise, but the existence of models (such as ordinary logarithms to a particular base) guarantees contradictionlessness in this less specific setting.

The real question here is how to justify the equation

`\qquad\qquad\qquad "lg"(x^n) = n\cdot"lg"(x)`

as a definition for multiplication of quantities in `L` by irrational numbers `n`.

One way to do this is to import into `L` the notion of order already found in `RR^+`.  One can then transfer the definition of an irrational in `RR` using, say, Dedekind cuts over the rationals, into a definition of irrational powers.

To import that order, simply assert that whenever positive real numbers `x` and `y` are such that `x \le y`, then `"lg"(x) \le "lg"(y)`.  This defines the meaning of `\le` in `L`.  Since  "`le`" is, in fact, a total order in `RR^+`, the version of  "`\le`" defined for `L` is also a total order, and the function `lg` is monotonic, and therefore continuous.

Consider, now, the quantities `x^u` and `x^w`, with `u` and `w` rational, `u < w`, and `x` a positive real number.  There are three cases :
  • if `x > 1`, then `x^u < x^w`,
  • if `x = 1`, then `x^u = x^w`, and
  • if `x < 1`, then `x^u > x^w`.
Now consider `x^v`, where `u \le v \le w`, where `v` is real, possibly irrational.

In all three cases, `x^v` lies between `x^u` and `x^w`, i.e.

`\qquad\qquad\qquad \min(x^u, x^w) \le x^v \le \max(x^u, x^w).

Then, by the monotonicity of `lg`, the quantity `"lg"(x^v)` lies between "lg"(x^u)` and "lg"(x^w)`, and so `"lg"(x^v)` lies between "u\cdotlg"(x)` and w\cdot"lg"(x)`.

Let `v` now be irrational, and for definiteness, assume the first case, `x > 1`.  Consider the Dedekind cut for `v`, i.e. the partition of the rational numbers into two subsets, those that are below `v` and those that are above `v`.  Then here `u` belongs to the lowside set, and `w` to the highside set.

Since we know how find rational multiples of `lg(x)`, the logarithms of the lowside and highside sets are also well defined in `L`.  Since `lg` is monotonic, the order also transfers, so just as every member of the lowside set is lower than every member of the highside set in `RR`, so also is every member of the image of the lowside set lower---in the sense that is used in `L`---than every member of the image of the highside set.  So, for the given `x`, we can define a Dedekind cut in `L`, and can use this to define multiplication of quantities `lg(x)` in `L`, when `x > 1`.

The argument for the case `x < 1` switches the ends, but is otherwise the same.

For the case `x = 1`,

`\qquad\qquad"lg"(x^u) = "lg"(x^v) = "lg"(x^w) = "lg"(1) = 0.`

Here, the Dedekind cut argument fails, but it still seems reasonable to define the product of `v` and `0` by

`"lg"(1^v) = "lg"(1) = 0 = v\cdot0`,

i.e. that `n\cdot0 = 0`, whether `n` is rational or irrational.

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"`,

  • `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 :


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 :


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


---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. )


`\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.

    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[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);

    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 :

    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[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);
    markerfill = "yellow";
    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);
    markerfill = "red";
    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);
    markerfill = "green";
    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);

    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 :

    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[0]=[10,-10]; text([10,-10],"1",above);
    a[1]=[11,-11]; text([11,-11],"100",above);
    stroke = "blue";
    aa[0]=[11,-10]; text([11,-10],"10",above);
    aa[1]=[10,-11]; text([10,-11],"10",above);
    markerfill = "yellow";
    stroke = "yellow";
    b[0]=[10,-10.5];  text([10,-10.5],"3.16",above);
    b[1]=[10.5,-10];  text([10.5,-10],"3.16",above);
    bb[0]=[10.5,-11];  text([10.5,-11],"31.6",above);
    bb[1]=[11,-10.5];  text([11,-10.5],"31.6",above);
    markerfill = "red";
    stroke = "red";
    c[0]=[10,-10.25]; text([10,-10.25],"1.78",above);
    c[1]=[10.25,-10]; text([10.25,-10],"1.78",above);
    cc[0]=[10.25,-11]; text([10.25,-11],"17.8",above);
    cc[1]=[11,-10.25]; text([11,-10.25],"17.8",above);
    markerfill = "green";
    stroke = "green";
    d[0]=[10,-10.75]; text([10,-10.75],"5.62",above);
    d[1]=[10.75,-10]; text([10.75,-10],"5.62",above);
    dd[0]=[11,-10.75]; text([11,-10.75],"56.2",above);
    dd[1]=[10.75,-11]; text([10.75,-11],"56.2",above);

    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 :

    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[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);
    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 :


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


    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,


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


    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


    Looking at the subtable in the top right hand corner,


    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 :


    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,


    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


    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


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


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


    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 :


    Consider, now, just the first two columns :


    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.


    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


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


    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


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


    As before, we can express this as


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


    Using stripiness and proportionality, the proportion table


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


    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,


    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 :


    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 :

    A standard addition table (not a proportion table of course, but rather a glide table,) looks like this :


    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 :


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