Logarithmic Tables

How are logarithmic tables calculated? (Dumbed down plz).

The classic way to calculate logarithms (and a great many functions) is to use the infinite series expansion of the function, which can be truncated when the desired precision is achieved, or if adding further terms doesn’t affect the values written down. You can find these in a lot of places (Abramowitz and Stegun, Gradshteyn and Rhyzhik, old edition of the CRC Handbook), but the simplest place thes days is online, as in Wikipedia:

more “dumbed down”

You can write down a mathematical formula to calculate the logarithm. To get the result with complete accuracy, the formula has an infinite number of terms. But you can get the approximately correct number with only the first few terms, so you only need to calculate those.

Tables of logarithms were calculated, I believe, originally by people actuaslly working through the math for each case, then later with mechanical calculators, and finally with computers. Before hand calculators were capable of doing these, engineers and scientists relied on previously calculated tables of logarithms, published in book form. I did this, and still have mine.

It was by observing that such tables didn’t get uniformly dirty that Frank Benford discovered the Benford Probabilities.

Engineers used slide rules as they were much faster than look-up tables. My maths teacher at school had spent part of WW2 in a bunker with a large cylindrical slide rule (ironically it was made in Germany) calculating trajectories for anti aircraft guns.

You can read off graphs. you can make a mechanism to make a very large graph.

You can do log in base 10 easily right,
and logN of X (in base N ), is log10 X / log10 N. (both base 10 logs. )

So if you can do log in one base, you can do log in any base using a single division.

Articles about the early calculation of the logarithmic tables:

Maybe you can do logs in base 10 easily, but for the rest of us, the easiest way to find base 10 logs is to start with natural logs, and then do the corresponding conversion you describe in the next line. Logs base 10 are only easy for 1, 10, 100, 1000, and so on, and if you’re taking the log of one of those, you’re not even looking at the table.

As to those tables, literally the first hundred pages of my CRC are tables of various mathematical functions, all of which can be calculated instantly to a greater precision using a $10 solar-powered calculator, or a free app that comes bundled with every smartphone. And the next hundred pages are tables of integrals, which can likewise be done instantly by a computer with the right software.

The OP did not say, but on one hand suppose I locked you in a room with nothing but paper, pens, and ink, and you had to produce a table of logarithms. If you use base 10 Arabic numerals, then of course you would produce the final table in base 10, and moreover there are many little tricks you would use to speed things up and check your work as you go along. It may be instructive to actually try this and see if you can get one or two digits of precision.

On the other hand, the modern version of this problem is how to program a digital computer to extract logarithms without some inputs resulting in a loss of precision, unreasonable slowdowns, or incorrect output. Easy to suggest it is all down to using an infinite series somewhere, but equally easy to screw up the algorithm.

Yes, I showed off my CRC Handbook to my high school students to properly impress them with how awful mathematics was in the dark ages. You know, the 70s. :stuck_out_tongue:

(Side note: the 70s is actually the watershed decade. I started high school having to calculate all sorts of stuff by tables, and finished high school using a TI-58C, IIRC, which did all of that sort of stuff for me)

I want to make explicitly clear how incredibly significant interpolation was in calculating tables by hand.

No, you did not calculate each value on it’s own. No, no, no.

You start off calculating every xth value. X being initial quite large. Then you interpolate some of the values in between. Then you iterate on those to make them more precise. Then you interpolate on the remaining ones. Do some sporadic checks by iterating some of those to make sure they’re accurate enough.

So 50-90% of a table could be from interpolation only.

One thing with logarithm tables is that once a block is filled in, it is quite easy to fill in the next block using the obvious identities. Again, some sanity checking here and there to make sure things haven’t drifted off too far.

Sine/cosine also have identities that were used but not nearly as simple as logarithms.

I love this. In order to calculate a logarithm, one must merely calculate a logarithm.

It’s recursion before they invented the base case.

Genius.

Here is some real C code to compute (but with no error-checking) logarithm base e.



/*
 * This code is loosely based on Freeware;
 * x_log() is similar to log() but does no error-checking.
 * x_frexp() accomplishes the built-in function frexp()
 *  but is much slower.  It is included to make this
 *  wholly self-contained.
 * No copyright is claimed by Septimus G. Stevens VII.
 * Use of this code for satiric purposes is encouraged.
 */
 
double x_frexp(double x, int *xpon)
{
	int	xp = 0;
	while (x >= 1)
		x /= 2, xp++;
	while (x < 0.5)
		x *= 2, xp--;
	*xpon = xp;
	return x;
}

double x_log(double x)
{
        double  z, w;
        int     xpon;

        x = 1.4142135623730950488 * x_frexp(x, &xpon);
	z = 2 * (x-1) / (x+1);
	w = z * z;
	x = z;
	z *= 	- w * 64.124943423745581147
		+ w*w * 16.383943563021534222
		- w*w*w * 0.78956112887491257267;
	z /=    -769.49932108494879777
		+ w * 312.03222091924532844
		- w*w * 35.667977739034646171
		+ w*w*w;
        return x + z + xpon * .69314718055994530941
		- .3465735902799726547;
}


The real story of how Napier constructed the first log tables is a fascinating tale in human ingenuity. What he actually calculated was something like -10^7*ln(10^{-7}*x). Why the natural log? Because he was in effect solving the differential equation y’ = 1/y.

He imagined an point moving from -1 on the x-axis towards 0 in such a way that its speed was inversely proportional to the distance from the origin. Why -1? I don’t know. That was how he thought of it and it is, in any case, that differential equation. Then he imagined dividing the axis into intervals of size 10^{-7}. He started with the value at -1 equal to 10^7. Then to go from one interval to the next, he multiplied by 1-10{-7}=.9999999 which sounds hard but is easy. Just take the multiplicand and under it the same shifted over by 7 places and subtract. Continue until you get to the point -1+10^{-6}. I think at that point he started using intervals of size 10^{-6} using his earlier work to interpolate the finer intervals. He continued this strategy until he got to -1/2 when he observed that the computations could be duplicated between -1/2 and -1/4. When he was finished he had a table of 7 place logarithms. Then Briggs came along and observed that base 10 logs would be much more useful. Then Briggs and Napier collaborated to start doing the necessary computations. Napier died before it was finished and Briggs finished the job.

Note that this was all done before calculus and certainly before differential equations. His genius was in seeing how this computation would give a function that converted multiplication to addition.

By Babbage’s time there were indeed power series known. The problem was that published had errors. His idea was to build a machine that would not only do the computations, but also* set it in type*. There were two problems. Do the computations correctly, but then get them into type and proofread it. Babbage wanted to solve both.

One of the people who lived on my floor at my dorm had the logarithm function memorized in such a way that he could “read off” three-place logarithms in his head, without looking anything up.
He could do it while drunk, too.

Supposedly Gauss had his logarithms memorized, to 5 digits. Memorizing your table of logarithms would be tremendously useful, and start to come naturally through practice, to anyone who did manual computations all day, eg in the 18th and 19th centuries; today it is not a practical skill.

As a young man, my dad had his logarithms meorized to (as I recall) 2 digits. It was a requirement for his NY state professional engineering registration, so everybody that did that exam had those numbers memorised.

2 digit tables perhaps aren’t ver useful, by they do allow you to interpolate three or 4 digits

A fun SciFi novel using human computers as an important plot device is The Three-Body Problem.

That doesn’t summarize the plot of The Three-Body Problem very well. It’s not about human computers. It’s about the contact between the inhabitants of Earth and a planet in the Alpha Centauri system. The interactions between that planet and the three stars in this solar system make the length of the days and nights on that planet very chaotic. That’s because the three-body problem of gravity has no general analytic solution:

Incidentally, here’s (what I think is) a better way of viewing the Wikipedia entry for The Three-Body Problem:

Monty, I don’t understand why the link in your post gave a different way of viewing the same entry in Wikipedia. In any case, the inhabitants of this planet of Alpha Centauri have this weird way of using quantum effects (or something) to encode a supercomputer into a single proton and send it to Earth. I don’t understand why that should be considered a human computer. I haven’t read the two sequels to The Three-Body Problem, so I don’t know if they have something to do with it.

The definitive sci-fi story in this respect is “The Feeling of Power,” by Isaac Asimov.

You can do more than that easily (to nearly two digits of precision). Remembering that a power of 2 adds about 0.3, we have log10(2)=0.3, log10(4)=0.6, etc. Since half a log is a square root, we also have log10(1.4)=0.15, and from there we can just interpolate, so log10(1.2)=0.075 and log10(1.7)=0.225 (roughly). Remembering that the square root of 10 is about 3.1, we also have log10(3.1)=0.5. That’s enough different values and factors to get pretty close.

An easy way to get an approximate log2:

  • Find the highest power of 2 smaller than your number (x)
  • Subtract x from your number
  • Divide that by x
  • Add log2 of x

Say you want log2(89). Subtract 64 to get 25. Log2(64)=6, so our answer is 6+25/64, or 409/64. That’s 6.39, while the real answer is 6.476. It’s at most 0.08 off from the real answer (actually, you can improve that to 0.04 by adding 0.04 to the final result). Multiply by 0.3 to get the log10.

Some of this is a bit silly and useless, but log10(2)=0.3 comes in very handy in engineering.

Well yes, 3db and 6db are welded into ones mind. I have a feeling many don’t even realise that these are approximations, and get confused when they see the extra decimal places.

There was a time when I had a few more of these approximations at my mental fingertips. Not so much anymore.