# Calculate ln(x) using 8-digit calculator

I have a bit of a unique problem. Well, maybe not a problem because I'm really just curious about it, but...

I have a simple 8 digit calculator. It has +, -, x, /, and a constant operation function. It has no usable memory slot.

I need (lit. would like to know how) to calculate ln(x) on this calculator. Any series I have found lose a lot of precision since whatever is outside the 8 digit range is truncated without rounding. I have used Padé approximants with trig functions, and a continued fraction for exp(), but none of these two methods are adequate for ln(x), either because there is no way around the truncation error or it requires writing down many intermediate values, or it requires memorizing and punching in many constants.

Does anyone know any good way to calculate ln(x) (or any other base, since memorizing one constant is OK) to as many digits as possible as easily as possible on this calculator (bonus points to methods where the value on the screen is immediately, meaning you don't need to write it down)?

For that matter, if you happen to know some good ways to calculate other special functions, I am interested in that as well.

Thanks!

I had a four-function calculator in the 1970s, and used to extract logrithms quite often from it. I used decimal logrithms.

The method was to use a crib-sheet (a page in a notebook), on which the antilogs of 0.1 to 0.9, then 0.01 to 0.09 etc, were written. One then divides by the largest number on the list, until one got a number like 1.0000 2135 or something. The 2135 bit was then divided by ln(10), to get the remaining digits.

The number could then be divided by log(e) or whatever, to get the desired value.

To calculate antilogs, the same sheet is used, but you multiply the expression up eg $2=10^{0.3}*10^{0.001}\dots$. The difference was pre-multiplied by 2.30... and 1 added to it. The whole process takes about four to six divisions to do, and this means you should be able to pull seven-digit logrithms from your calculator.

• Cool method, I like it! Thank you for the good answer – Mahkoe Mar 25 '14 at 11:38
• I thought I had understood, but it turns out I don't. Why would you divide 1.00002135 by ln(10)? – Mahkoe Mar 25 '14 at 12:25
• When you prepare the tables for something like $10^{0.00n}$, you will see that the entries are in essence, 1+ln(10)*0.001. So this makes the required difference. – wendy.krieger Mar 26 '14 at 7:17

Perhaps a formula due to Gauss is useful. But I believe you'd be most interested in Goldberg's "Computing Logarithms Digit-by-Digit" (BRICS Report RS-04-17, University of Aarhus, 2004).

• This is a very well written paper, and it seems like something I could use. Thank you! – Mahkoe Mar 25 '14 at 11:36
• The trouble with using the method given in Goldberg is that errors build up quite readily. For example, finding the logrithm of 2 by this means gives .301029 something like 60 multiplications, where as i use something like five. If you don't have a crib-sheet, it is a good standby, but the increased errors ought be noted (as well as the necessity of counting to 10 six or so times). – wendy.krieger Mar 27 '14 at 13:01

Compute once and for all $$\ln 2=\sum_{k=1}^\infty{1\over k\>2^k}\ ,$$ and store it in your constant register $c$.

Given an arbitrary $x>0$ divide or multiply it by $2$ as many times as needed to produce a number $y\in\bigl[{1\over2},1]$, and keep the number $n\in{\mathbb Z}$ of times you have divided by $2$ in your head. Put $z:=1-y$. Then $0\leq z\leq{1\over2}$ and $$\ell:=-\ln y=-\ln(1-z)=\sum_{k=1}^\infty {z^k\over k}\geq0\ .$$ Finally $$\ln x= n c-\ell\ .$$

First of all, if you want you can work with base-10 logarithms and then convert it to natural log by a simple multiplication with a pre-computed constant:

$$\ln x=\ln 10\log_{10}x$$ where $\ln 10\approx 2.303$.

So... shift your number to the range [0.1,1] which tells you the whole part of the logarithm:

$$\log_{10}103.42=3+\log_{10}0.10342$$ $$\log_{10}0.0043=-2+\log_{10}0.43$$

The rest you can do back in the natural base. Better than a Taylor series is a Pade approximant. For instance, you could use

$$\ln (1+x)\approx \frac{x(6+x)}{6+4x}$$

You could find a Pade approximant for the base 10, if you don't like to convert all the time. I suggested base-10 reduction because it is visual - you could also divide/multiply repeatedly by $e$.

The following is not straightforward, but, as far as I know, it is the easiest way to use elementary function. I propose to use the Taylor expansion as follows: $$\ln(1+x)=\sum_{k=0}^{\infty}\frac{(-1)^{k+1}x^k}{k},$$ At least for $x\approx 0$.

• Your $\log$ series is flawed. – Christian Blatter Mar 25 '14 at 11:21
• Oops, I mistyped the factorial sign! Edited! – 7raiden7 Mar 25 '14 at 11:44