From: Dave Rusin Subject: Re: logarithms, derivation Date: Wed, 23 Aug 2000 09:04:48 -0500 (CDT) Newsgroups: sci.math Summary: You, too, can compute logarithms in your very own home! In article <39A3204C.FD960330@mindspring.com> you write: >I hope this is not a FAQ, but I would like to know how to generate, >derive, figure out, common logarithms. Formula, series, method, etc? > >In other words, if one were on a desert island -- even with a hand >calculator, but one that didn't have a "log" button -- and Mr. Selkirk >had not left a copy of Napier's classic 1616 paper, how would one find >the common logs of say, the numbers 2-9? Know some nice round products: 3^2 = 9 ~ 10 so then log(3) ~ 0.5 (You said _common_ logs, right?) 2^10 = 1024 ~ 10^3, so 2 ~ 10^(3/10), so log(2) ~ 0.3 5 = 10/2 so then log(5) ~ 0.7 7^2 = 49 ~ 50 = 10^1 x 5 so then log(2) ~ (1.7)/2 = 0.85 Get the others by multiplying, e.g. log(6) = log(2) + log(3). Of course, if you happened to know that e.g. 7^510=1000000937776...5249 (a total of 432 digits) then you'd know that log(7) was given more accurately by 431/510=0.84509803921... (it's actually 0.84509804001...). Likewise with, say, 2^2136 ~ 10^643 and 3^153 ~ 10^73. dave [A small typo has been fixed. --djr] ============================================================================== From: "Richard G. Gould" Subject: Re: logarithms, derivation Date: Wed, 23 Aug 2000 11:42:15 -0400 To: Dave Rusin Very funny, very funny. No, actually, very clever, Dave. And practical too: If Alexander Selkirk really was on a desert island and needed a log on which to float away to civilization, your method would provide him with a means of transportation. In fact, a log of 2 would allow him to take His Man Friday along. Have you though of establishing a new newsgroup: sci.math.humor? Your "9 is almost equal to 10" reminds me of an account, perhaps apocryphal, of a law passed by a mid-western state legislature (no, Dave, not Illinois) stating that the value of pi should be taken as 3.0 in all filings to state agencies. Actually, knocking off the .14159265358979323626... results in an error of only about 4.7%, whereas 10/9 is an 11.11111111...% difference. All of which is to say, defensively, that I wish I had come up with your method of finding approximate logarhythms (which is an autological spelling, since it too is an approximation to logarithms). O.K., O.K, let me rephrase my original question: How can one compute common logarithms of numbers with, say four significant figures, to an accuracy of four or five decimal places? I'll start: log [1,000] = 3.00000. Now it's your turn. You do log [1,001]. Sincerely (if somewhat facetiously), Rick Gould Dave Rusin wrote: [quote of previous message deleted --djr] [reformatted --djr] ============================================================================== From: Dave Rusin Subject: Re: logarithms, derivation Date: Wed, 23 Aug 2000 12:23:27 -0500 (CDT) To: rggould@mindspring.com >Sincerely (if somewhat facetiously) Actually I didn't mean it as humor! Of course, "9~10" is a poor approximation, which is why we only get log(3)~.5 instead of log(3)=0.47712... If you want a better approximation to log(3), you need a better approximation than "9~10" but one which still involves powers of 3 and 10. They exist (as I noted later in my letter). Indeed, they are easy to generate ex post facto: if you know log(3) to great accuracy, you may compute the continued-fraction approximants to this, and get an infinite sequence of pairs (a,b) of integers with the property that the ratios 3^a/10^b approach 1, starting with 3^2/10^1. Well, "ex post facto" is not a good desert-island method, I admit, but it's not all that bad either. So far I have only used the fact that two nearby numbers can have only 3's and 10's in their prime factorizations. We can get better approximations for logs by finding some very close numbers with simple factorizations. It pays to use these to compute several logs at once. For example, there are many easy-to-find pairs of consecutive numbers all of whose prime factors are among 2, 3, 5, 7, 11: examples are {n, n+1} where n=120, 125, 175, 224, 242, 384, 440, 539, 2400, 3024, 4374, 9800... In each case, we may expand the statement log(n+1) - log(n) ~ 0 into a linear combination of log(2), ..., log(11). Here are a few of them: 2 log(11) - 3 log(2) - log(3) - log(5) ~ 0 5 log(3) - log(2) - 2 log(11) ~ 0 4 log(7) - 5 log(2) - log(3) - 2 log(5) ~ 0 4 log(5) + log(7) - log(2) - 7 log(3) ~ 0 Substitute log(5) = 1-log(2), treat "~" as "=", and solve. I get log(2) ~ 45/149~0.302, log(3) ~ 71/149 ~ 0.477, log(7) ~ 126/149 ~ 0.846 and log(11) ~ 155/149 ~ 1.040. All these answers are off by at most 0.001. So you see you can trade off a little, and consider smaller numbers (than 2^huge) but with more unknown values taken at once. You want better approximations? Take only large pairs {n, n+1}, including if necessary a few more prime divisors. (A familiar example: n=10^3, with 1001 = 7*11*13.) You had asked for desert-island mathematics, so I assumed you wanted only rough approximations for the values of the logs. The theory is good for arbitrary generality, but of course the work gets prohibitive. Naturally, there are other methods you could use if your desert island included a programmable calculator: If you have a nearby number N whose log is known, then you can compute log(x) = log(N) + log(x/N) = log(N) + log(1 + (x-N)/N). The last can be computed e.g. by log(1 + t) = t - t^2/2 + t^3/3 - ... ; continue until tired. If I were writing programs, that's what I'd do. If I were on an island, or stuck in the 16th century, I might really go the route shown earlier. You'll surely get the standard answers in the newsgroups. The general setting for that kind of question is "Numerical Analysis", and indeed there is a newsgroup sci.math.num-analysis, which is all about the methods for deriving very-close-to-accurate numerical answers to mathematical questions. See also index/65-XX.html dave ============================================================================== From: rusin@vesuvius.math.niu.edu (Dave Rusin) Subject: Re: Logarithm Questions Date: 13 Oct 2000 06:21:44 GMT Newsgroups: sci.math Summary: [missing] In article , HollyKing wrote: >Second, how could I calculate a logarithm. Sure, my calculator can do >common and natural logarithms and I can look logarithms for other bases up >in tables. However, someone had to calculate the tables. How do they do >that? Your calculator uses a number of tools developed with the aid of calculus. These give the "right" answers. But you can do pretty well estimating these on your own. I worked out some examples for someone who asked a similar question a couple of months ago here. Here's an abridged version of my comments at that time. dave [A version of the previous message was posted -- djr] ============================================================================== [Some experiments which were not posted. --djr] Checking primes thru 13 on pairs {n, n-1} with n < 350 000: good n= [10, 11, 12, 13, 14, 15, 16, 21, 22, 25, 26, 27, 28, 33, 36, 40, 45, 49, 50, 55, 56, 64, 65, 66, 78, 81, 91, 99, 100, 105, 121, 126, 144, 169, 176, 196, 225, 243, 325, 351, 352, 364, 385, 441, 540, 625, 676, 729, 1001, 1716, 2080, 2401, 3025, 4096, 4225, 4375, 6656, 9801, 10648, 123201] Checking primes thru 23 on pairs {n, n-1} with n < 1 250 000: good n= [smalls, 8625, 9801, 10241, 10626, 10648, 10830, 11271, 11662, 12168, 12376, 12636, 13377, 14080, 14365, 14400, 16929, 19551, 21505, 21736, 23276, 23409, 25025, 25921, 27456, 28561, 28900, 31213, 37180, 43264, 43681, 52326, 71875, 75141, 76545, 89376, 104329, 104976, 122452, 123201, 126225, 152881, 165376, 194481, 202125, 228096, 264385, 282625, 328510, 336141, 601426, 633556, 709632] so e.g. last seven plus the one for 194481 give equations from which to deduce log(p) for p=3,5,7,11,13,17,19,23 (and log(5) = 1 - log(2).): all are fractions over 55835, roughly l2 = 0.3010298200 true = .3010299957 l3 = 0.4771200860 true = .4771212549 l5 = 0.6989701800 true = .6989700041 l7 = 0.8450971613 true = .8450980400 l11 = 1.041389809 true = 1.041392685 l13 = 1.113942867 true = 1.113943352 l17 = 1.230446852 true = 1.230448921 l19 = 1.278749888 true = 1.278753601 l23 = 1.361726516 true = 1.361727836