All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Algorithms
Just by hand, only by hand, nothing but by hand? (Posted on 2004-07-26) Difficulty: 4 of 5
Imagine you are living a lot of years ago, without calculators, slide rules, tables of logarithms, or any kind of tool but paper and pencil... how would you go about calculating log10 of 2 -- or of any other number?

By the way, if your solution required calculating powers, or if you just wanted to check your solution, how would you calculate 10 to the 0.30103... power, or any other?

See The Solution Submitted by Federico Kereki    
Rating: 4.1667 (6 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution put another way | Comment 2 of 7 |
(In reply to A Very Primitive Method by Richard)

We should start with the second part, as that is easier to explain and raising to a power is more basic than taking a logarithm.

We want to raise 10 to the .30103 power (to that degree of accuracy).  These old-time people could take square roots, and so of course could find fourth roots, eighth roots, etc. by taking the square root of the square root, etc.  The exponent .30103 can be expressed as the sum of powers of 1/2.  This is now known as the binary numbering system.  To express as binary, you just double the fraction; the digit to the left of the decimal point will be the first binary digit after the binary point.  Throw away that digit and double what's left; this time what appears to the left of the decimal point becomes the next digit in the binary representation, and so forth.

So, doubling .30103 gives 0.60206 and thus far the binary representation is .0.
Doubling .60206 gives 1.20412 and the binary representation becomes .01.
Doubling .20412 gives .40824 and the binary representation becomes .010.
Doubling .40824 gives .81648 and the binary representation becomes .0100.
Doubling .81648 gives 1.63296 and the binary representation becomes .01001.
Doubling .63296 gives 1.26592 and the binary representation becomes .010011.
  ...

Taken far enough, we get a binary fraction .010011010001000....

Remembering that adding exponents (or logarithms) corresponds to multiplying numbers, this binary representation means that we have to multiply the fourth root of 10 by the 32nd root of 10 and by the 64th root of 10 and the 256th root of 10, etc. (whichever positions have a 1 in the binary representation).  Since these are the roots that can be determined by extracting successive square roots, we are set.

The roots of 10 for which 1's appear in the binary expansion, and their values, come out to
root   value
    4  1.778279
   32  1.074608
   64  1.036633
  256  1.009035
 4096  1.000562
and those values multiply out to 1.999979.  They'd come out closer to 2 the further the binary representation were carried out.

Taking a logarithm is, as expected, just the reverse:

10        2
 3.162278 2.000000  .0                 0.500000
 1.778279 1.124683  .01                0.250000  0.250000
 1.333521 1.124683  .010               0.125000
 1.154782 1.124683  .0100              0.062500
 1.074608 1.046598  .01001             0.031250  0.031250
 1.036633 1.009613  .010011            0.015625  0.015625
 1.018152 1.009613  .0100110           0.007813
 1.009035 1.000573  .01001101          0.003906  0.003906
 1.004507 1.000573  .010011010         0.001953
 1.002251 1.000573  .0100110100        0.000977
 1.001125 1.000573  .01001101000       0.000488
 1.000562 1.000011  .010011010001      0.000244  0.000244
 1.000281 1.000011  .0100110100010     0.000122
 1.000141 1.000011  .01001101000100    0.000061
 1.000070 1.000011  .010011010001000   0.000031
                                                 0.301025

Down the left column are the precalculated (done by hand of course in the olden days, but by machine nowadays) square, fourth, eighth, sixteenth, etc. roots of 10.  The second column starts with 2. The square root of 10, in the second line, is larger than 2, so a zero starts off the binary representation of the logarithm.  However, the fourth root of 10 is less than 2, so 2 is divided by the fourth root of 10 and the quotient is placed under the 2 and a 1 is appended to the binary representation of the log.

In each row, if the given root of 10 is less than what's in the second column in the row above, that root is divided into the number in column 2 to give the new number in column 2 and a 1 is appended to the log.  If, however, the number is larger than the number above and to the right, the latter is just carried down, and a zero is appended to the log, as when 1.222521 is larger than 1.124683, and so is 1.154782.  It is only when we get to 1.074608, that we can divide that into 1.124683 to get 1.046598 and append our second 1 to the log written in binary.

At the end (at whatever precision we decide to stop), the number, .010011010001000, is converted to decimal. The first binary position is worth .5; the next, .25; the next, .125; etc. adding in only the 1's positions.  The last column above shows only those powers of 1/2 that correspond to 1 bits in the binary-coded logarithm being built, and the total appears at the bottom of that column.  We really needed to carry it further for the decimal accuracy desired.

Edited on July 26, 2004, 2:14 pm
  Posted by Charlie on 2004-07-26 14:13:44

Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (6)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information