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.

    No comments:

    Post a Comment