# Is there an approximation to the natural log function at large values?

At small values close to $x=1$, you can use taylor expansion for $\ln x$:

$$\ln x = (x-1) - \frac{1}{2}(x-1)^2 + ....$$

Is there any valid expansion or approximation for large values (or at infinity)?

Almost as Semiclassical answered, write $x=A \times 10^{n-1}$ where $n$ is the number of digits before the decimal point, that is to say $1\leq A < 10$ and use the very fast converging expansion $$\log \left(\frac{1+y}{1-y}\right)=2\sum_{k=0}^{\infty}\frac{y^{2 k+1}}{2 k+1}$$ with $y=\frac{A-1}{A+1}$.

Let us take an example : $x=123456789$; then $A=1.23456789$ and $n=8$; so $y \approx 0.104972$. Now, let us look at the value of $$S_p=2\sum_{k=0}^{p}\frac{y^{2 k+1}}{2 k+1}$$ For the first values of $p$, the sums are successively $0.2099447424$, $0.2107158833$, $0.2107209817$, $0.2107210219$, $0.2107210222$ which is the solution for ten exact decimal places.

So, by the end $$\log^{(p)}(x)=(n-1)\log(10)+ S_p$$ which leads to the successive values of $18.63062549$, $18.63139663$ ,$18.63140173$, $18.63140177$, $18.63140177$ for an exact value equal to $\approx 18.63140177$.

• Can this expansion be modified, so that it is also valid for complex numbers? Or does there exist another series which will calculate natural logarithm of complex number? – blindProgrammer Oct 14 '20 at 11:37
• Also is this expansion valid for negative real and complex numbers? – blindProgrammer Oct 14 '20 at 12:51

for any positive $x$

$\ln \left( x \right) \approx a{x^{\frac{1}{a}}} - a$
where $a$ is any large constant

The larger $a$, the better approximation.

• Can you clarify further – Shailesh Aug 10 '17 at 3:07
• Dear Shailesh you can try that using MATLAB as an example ln(10)=2.3026 for a=10 : $10 \times {10^{\frac{1}{{10}}}} - 10$=2.5893 – Elamassie Mohammed Aug 11 '17 at 7:10
• for a = 50 , $50 \times {10^{\frac{1}{{50}}}} - 50 = {\rm{2}}{\rm{.3564}}$ – Elamassie Mohammed Aug 11 '17 at 7:15
• as constant a become larger the approximation will be more accurate – Elamassie Mohammed Aug 11 '17 at 7:16

Hint: $~\ln x=-\ln\dfrac1x~:~$ Can you take it from here ?

• I'm not sure what you're suggesting. Could you elaborate? – Antonio Vargas Oct 17 '14 at 2:31
• @AntonioVargas: Are you referring to the very slow convergence of $~\displaystyle\sum_{n=1}^\infty\dfrac1n\bigg(1-\dfrac1x\bigg)^n~$ ? – Lucian Oct 17 '14 at 3:36
• If that is what you were suggesting then yes. It converges ever more slowly as $x$ grows larger. Taking only finitely many terms of that series yields an approximation that is "good" only when $1/x$ is close to $1$ (and so when $x$ itself is close to $1$). – Antonio Vargas Oct 17 '14 at 4:08
• @AntonioVargas: I agree ! My idea was that for $x>1$ the series from the original post diverges. Obviously, slow convergence beats divergence. – Lucian Oct 17 '14 at 4:18

A crude approach is to assume scientific notation: If $x=A \times 10^n$ where $1\leq A < 10$. Then $\ln x = \ln A + n\ln 10\approx 2.3n$. To be a little more precise, we know $\ln x\in [n \ln 10,(n+1)\ln 10)$.

There is no polynomial or rational approximation to $\ln(x)$ that is accurate for all large $x$.

This follows from the fact that $\ln(x) =o(x^{\epsilon})$ for every $\epsilon > 0$.

There is a procedure from my complex variables class fifty years ago called "analytic continuation" that allows you to modify a power series to a different radius of convergence. But any series will have a finite radius of convergence, and when you get near that cutoff point, convergence is very slow. That is why most log routines incorporate scaling to reduce the range. However, instead of scaling by the number base, you can take the square root of the argument.

Pade approximations are rational functions that frequently beat truncated power series. Although you still have the problem of limited range, you reduce the need for range reduction. For example, Ln(1+x) = x(6+x)/(6+4x).

As for the previously posted series above with y = (a-1)/(a+1), I have seen a Pade approximation that is truly spectactular. It is in the article on Shank's Transformation, and it is P{ ln (1+y)/(1-y) } = 2y*(15 - 4y^2 )/(15 - 9y^2 ) ln(1) = 0, ln(2) = 0.693122 max error = -0.000025. You should probably use a computer algebra system for this work to reduce the frustration and likelihood of error.

If you just need to compute logs somewhere, consider using a table of multipliers and their logs. Good multipliers are powers of two or have only two bits, so you can do the multiply quickly in hardware by shift and add. Their logs will have as many bits as you need. So you do something like the Handbook of Mathematical Functions table 4.3 to bust the argument down to a range where the approximation is good. See Knuth, vol 1 page 22++ for algorithms that compute logs one bit at a time. One of these is due to Euler, and involves a square root for each bit; the other squares x and divides by the base of the log if the square is greater than the base. Since your base is e, that division would demand greater resources than division by 2 or 10.

The taylor series for $\ln(\cdot)$ in the vicinity of point $a$ is

$$\ln(x+a) =\ln(a) + 2 \cdot (y+\frac{y^3}{3}+\frac{y^5}{5}+\frac{y^7}{7} + \ldots + \frac{y^{2n+1}}{2n+1}), \mathrm{where\;} y=\frac{x}{x+2a}$$

So for fast convergence, we need the logarithms of first 26 primes numbers: $2,3,5,7.\ldots$