Pages

Saturday, April 9, 2011

Calculating the Log of a Number by Hand

I’ve become interested in logarithms—for a reason. Sometimes, like others, I use log scales to show graphics. The reason is that they make it easier to highlight some features of the data. In the process of writing a still unpublished post on that subject, I got to looking deeper at the origins of logarithms. My own penchant is to understand things from the bottom up. Thus I became aware of the fact that one finds very few resources on the Internet that go deeply into ancient things—whereas the easy and superficial is almost over-documented. My initial wonder arose over fractional exponents. Let me get into that first.

We know that the log of numbers of the common (base 10) logarithm are “powers of ten.” The log of 10 is 1; it is not multiplied by anything. It is the base. But 100, which is 10 x 10, is written as 102 and the log of 100 is 2. Log 1,000 is 3, 10,000 is 4, and so on. On multiples of 10, count the zeroes and you know the logarithm of the number. But what about other numbers? If I ask my spreadsheet or calculator for the log of 2, the answer will be 0.30103. Put another way, it means that 2, expressed as a power of 10, is that fraction, and that 10.30103 equals 2. But while the logs of 10 and its multiples make sense, and in every case tell me how often to multiply 10 by itself, how does one handle a fractional log? How do I get from 10.30103 to obtain the answer, 2, without using a logarithmic table? I can’t picture how a number might be multiplied by itself a fractional number of times.

My quest to understand the logs thus began by looking at its originator, John Napier (1550-1617), to see how he came up with those fractions. But it turns out that Napier’s initial logarithm was base 10,000,000—and while tracking his calculations is possible (here is his own account of it)—I was looking at an example of our own now dominant log to the base of 10. In what follows, therefore, I am echoing Leonard Euler (1707-1783), and more specifically a fine article by Ed Sandifer available here the content of which I am here rendering for the amateur. In that process, as I will show, one doesn’t really calculate these logs; one finds them, painstakingly, by pulling roots. First I’ll show a spreadsheet that calculates the log of 2. Next I will explain it.

Euler begins with two numbers the log of which is known from the outset, 1 and 10. The number 2 is between these two. Their logs are 0 and 1. Euler proceeds by multiplying 1 and 10 and pulling the square root. One times 10 is 10, and the square root of that is 3.16228. He performs the identical operation on the logs. Adding logs is to multiply them, therefore 0 + 1 = 1. This he divides by two, equivalent to pulling the square root. The result is 0.5. One can check this result by using a calculator. Sure enough, log(3.16228) is 0.5. The operations are placed under labels: A, B, and this last one, under C. Now, let us understand. He is looking for 2. His first result, 3.16…, is greater than 2. He next multiplies the two values closest to 2 on either side, thus the 1 in A and 3.16.. in C. He multiplies them and pulls the square root again, placing this result (1.77828) into row labeled D. Next he performs the same operation in the log column: 0 + .5 = .5 divided by 2 = .25. And, sure enough, checking that we find that log(1.77828) is .25. So now we’re on our way. Using this method, we proceed to find the two values above to either side of 2 and as close to it as possible. Those two are in rows C and D. Using those we proceed to the next step. I think I’ve gone far enough to make the procedure clear.

When continued, and the illustration documents the steps, we finally get, in row T, the answer we are looking for. We get the number 2 and, in the log column, the value of .301029. The actual number Excel gives me, if I take it out to 20 decimal points (the command typed in the cell is =log(2)) is .30102999566398100000; Excel shortens that to .30103.

Let me here indicate the Excel commands used. In the column labeled Actual, the formula in cell B8 and subsequent cells, references changing as indicated by the comment, is:

=SQRT(B7*B6)

In the column labeled Log, the formula in cell C8 and subsequent cells, references changing, is:

=(C6+C7)/2

The reader might fault me for not pulling my square roots manually. Sorry. I cut myself some slack there. That too is a lengthy process with large numbers, but I do know how to do that.

Finding the first few logs is difficult and time consuming. But later the very nature of the exponents makes the job go faster. Adding logs is multiplication, deducting logs is division. Having the logs of 1, 10, and 2, we can rapidly proceed thus:

• The log of 5 is obtained by dividing 10 by 2, thus 1 - .30103 = .69897.
• The log of 4 is easy too, 2 x 2, thus .3013 + .3013 = .60206.
• The log of 8 is 4 x 2, therefore .30103 + .60206 = .90309.
• The log of 20? No problem. 2 x 10 = .30103 + 1 = 1.30103.
• The log of 40? It is 1.60206.
• And 400? It is 2.60206. Simple, 100 x 4, 2 + .60206.

And so on. Prime numbers divisible only by 1 and themselves require the long process. 3 and 7 require slow calculation. But after that it is easy to calculate the log of 6, 9, 12, 14, 60, 70, 90, and so on. Not that we have to. A thirty dollar calculator or an Excel spreadsheet has them all. But it is valuable to understand things from the ground up.

One learns in this process that the integer portion of a log number always refers to multiples of ten (thus of the base), and the fractional parts to “fractions” of ten. The fractions are obtained by division, obtaining roots, the integers by multiplication.

In this process I also came to understand that logs are a geometrical series; the terms change by the same ratio. In a log base 10, the geometrical progression is represented by 10: 10, 100, 1000, etc. In a log base 2, the progression is by 2: 2, 4, 8, 16. In the first, integer logs will be exact multiples of 10—all other numbers will be or have a fractional component. In a log of base 2, integer logs will be multiples of two. The unchanging ratio is multiplication by the base or division to detect the root of the base.

In arithmetical series, the terms always change by the same amount. In the decimal system that amount is 1 or a fraction of 1. When a geometrical series is used to index an arithmetic series, the advantage is that multiplication and division of the indexed arithmetical series may be replaced by adding or deducting logs. This very much increases the efficiency of manual calculation—which was Napier’s motivation for developing logarithms in a time when mechanical calculators, and never mind lightning speed electronic devices, were still far in the future.

I’ll indulge my fascination with this subject in future posts as well—and perhaps they will help others too.

12 comments:

  1. Wow, a tour de force!

    I read this post carefully, and slowly, following each step along the way and I think I followed it. However, I have no illusions about having actualy learned it. Luckily, I can come back to this again as I need.

    Thanks.

    ReplyDelete
  2. Great article!!
    I am a student in Japan.
    I'm still an abecedarian, so forgive me if my English isn't grammatically correct (-"-;A...
    You said finding square roots is "a lengthy process with large numbers." I don't know what type of method you were referring to, but in Japanese schools we learn a method resembling long division for finding square roots by hand.
    If you haven't ever heard about this method I would love to tell you about it!!
    Here's my email: mojo6087-kaomoji@yahoo.co.jp
    Feel free to email me!
    I would love to learn some English!!

    ReplyDelete
  3. Your English is excellent, Anonymous. A post on this blog called "In Case You Wondered" (http://lamarotte2.blogspot.com/2011/04/in-case-you-wondered.html) shows one method for pulling square roots. I'd like to know how you do it in Japan.

    ReplyDelete
  4. This is a fantastic article and I thank you for posting this. I'm an aircraft engineer and generally interested in maths and science. Currently I'm reading a book called "Alex's adventures in number land," and there is some discussion of the history of the Log of a number but I must confess that the Internet is not forthcoming with such a clear and precise explanation of prime numbers under 10. I struggled to work out Log 2 for a considerable time before coming across your explanation. Many thanks.
    Jerry

    ReplyDelete
  5. And, thanks to you, Jerry, I now know what my next gift for Arsen will be: "Alex's Adventures in Number Land" sounds like the absolutely perfect book for my Renaissance Man.

    ReplyDelete
  6. How do you find the log of a number smaller than one? For example, 0.12?

    ReplyDelete
  7. In answer to your question, Kathy, it's tedious, but can be done. First note the number of digits behind the decimal point, in your case 2. Next, calculate the log of 12, thus .12 * 100. That will turn out to be 1.79181. Next, take 2 away from that number, thus 1.7981 - 2 = -0.92082. That is your answer.

    A three digit number (e.g., .999) requires calculating log(999) first. That turns out to be 2.999565. Take 3 (for three digits) away from that, thus 2.999565 - 3 = -0.00043. That is your answer for log(.999).

    I've tried this also on log(0.7892). In that case, too, it works as advertised, although calculating the log of 7892 gets a bit tedious. The result, less 4 (for 4 digits) is -0.10281.

    The number of digits needed to render the fraction into a whole number, taken from the log of the whole number, gives you the log of the fraction.

    Now, of course, to calculate the log of 12 by hand, you have to revise the technique provided by starting with log(1)= 0 and log(100) = 2, in order to bracket 12. Hand calculation gets very tedious once you get beyond the first 10 numbers.

    Are you a teacher? Just curious...

    ReplyDelete
  8. Nice article, a great lead in quest to calculate
    2^0.c(1)c(2)...c(n)

    This, and your latter

    http://lamarotte2.blogspot.in/2011/04/hand-calculation-of-fractional-decimal.html

    which goes together with this

    ReplyDelete
  9. Thanks, Sunil. Your own quest sounds rather intriguing!

    ReplyDelete
  10. Very good article. One thing you may want to look into as well is anti-logarithms. That is, once you have the logarithm of the 12th root of 2 (.02509), how do you get back to the twelfth root itself (1.05946)?

    ReplyDelete
  11. Other method:

    log 123

    123 / 10 = 12,3 (1 time)
    12,3 / 10 = 1,23 (1 time)
    1,23 < 10 => log 123 = 1 time + 1 time = 2

    Continue:

    1,23 ^ 10 = 7,92594609605189126649
    7,92594609605189126649 < 10 => log 123 = 2,0

    Continue:

    978388059,77257474352566705351629 / 10 = 97838805,977257474352566705351629 (1 time)

    97838805,977257474352566705351629 / 10 = 9783880,5977257474352566705351629 (1 time)

    9783880,5977257474352566705351629 / 10 = 978388,05977257474352566705351629 (1 time)

    ...

    9,7838805977257474352566705351629 < 10 => log 123 = 2,08

    Continue:

    9,7838805977257474352566705351629 ^ 10 = 8037323323,9663782977799315503308

    log 123 = 2,089....

    and so on...

    ReplyDelete
  12. In case you didn't get it... here is another explanation of this method by W. Blaine Dowler June 14, 2010 "Calculating Logarithms by Hand"

    http://fiziko.bureau42.com/teaching_tidbits/manual_logarithms.pdf

    Basically Euler's Method uses the exponent property of logarithms, use two numbers you know of, to find a new number you didn't know before (and the corresponding logarithm.) Rinse, wash, and repeat until you converge upon the logarithm you're looking for.

    I suspect this tedious process is the reason calculation machines were produced (as can be seen in the Science Museum in London.)

    ReplyDelete