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)?
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$.
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.
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$.
The Taylor series for $\ln(\cdot)$ in the vicinity of point $a$ is
$$\ln(x+a) =\ln(a) + 2 \cdot \left(y+\frac{y^3}{3}+\frac{y^5}{5}+\frac{y^7}{7} + \ldots + \frac{y^{2n+1}}{2n+1}\right), \text{ where } y=\frac{x}{x+2a}$$
So for fast convergence, we need the logarithms of first $26$ prime numbers: $2,3,5,7,\ldots$.
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)$.
If the number whose logarithm you require is real and positive, Borchardt's algorithm, which is similar in structure to Gauss' AGM algorithm, if started with initial values 1 and x, will converge to (x-1)/Ln(x) for large values of x, although many steps will be required, each involves a square root, and convergence is not quadratic. From this, Ln(x) can easily be calculated. However, convergence can be accelerated by extrapolation methods well known to the number crunching community. Borchardt's algorithm was a popular way to compute logarithms by FORTH programmers in the last century.
Another popular method for computing logarithms was to compute the exponential function (inverse of the desired logarithm function) of an initial guess. Exponential function is a rapidly converging power series, so it is quickly computed. A solver routine then adjusts the approximation to get the desired logarithm. If your number is in floating point, you can extract an appropriate guess for the logarithm from the biased exponent portion of the floating point notation.
There is no rational function (or polynomial) that will do the job. To see this, suppose the power of the denominator is greater than the numerator. For large values, the rational function will approach zero. The logarithm does not. Suppose the power of the numerator and denominator are equal. Then for large values of x the rational function approaches a constant. The logarithm does not. And if the power of the numerator is greater, the rational function grows at least linearly; the logarithm does not. So there is no rational function (or polynomial) that can approximate the logarithm for large values.
That being said, rational functions called Pade approximations beat truncated power series. This is because the Pade approximation, when expanded into a power series matches the truncated power series for several terms, and then includes additional terms of higher power that approximately match terms of the logarithm series that were cut off. To learn about Pade approximation, see a text on continued fractions. Otherwise, if you are lazy, Wolfram has a continued fraction generator on line.
Much has been learned since the time of Napier and Briggs.
Hint: $~\ln x=-\ln\dfrac1x~:~$ Can you take it from here ?
x-1 is a crude approximation that is good for values of x close to 1.
2*(x-1)/(x+1) is a better approximation with a larger range.
6*(x-1)/(1 + 4 * Sqrt(x) + x) is better and has an even larger range.
90*(x-1)/(7+32 * x^(1/4) + 12 * x^(1/2) + 32 * x^(3/4) + 7 * x) is even better and has a larger range, but it never exceeds 90 for any positive real value of x.
Some such approximations are better than others, but any of these fail for sufficiently large x.
(Note that the fourth root in that last formula can be found by taking the square root twice).
In this other question I found an approximation as follows: $$\ln(x+1) \approx \dfrac{\ln(x)}{1-x^{-\frac{1}{\ln(2)}}}$$
By differentiating both sides, since just one logarithmic terms remains you could find the following approximation: $$\ln(x)\approx \dfrac{\ln(2)\ x^{-\frac{1}{\ln(2)}}\left(x^{\frac{1}{\ln(2)}}-1\right)\left(x^{\frac{1}{\ln(2)}}+x\right)}{1+x}$$
which works pretty good for $x\in [0.1,\ 10]$ as can be seen in Wolfram-Alpha, but it get worst for bigger values of $x$, but anyway, maybe it could be improved knowing how it has been done.
For bigger values of $x$, following this answer, this formula could be used:
$$\ln(x)\approx x\ \left(x^\frac{1}{x}-1\right)$$
Added later
Later I found here that the first approximation could be improved with an even simpler formula, which works quite good for $x\in [0.02,\ 50]$:
$$\ln(x) \approx = \frac{\left(x-1\right)\left(x+x^{\ln(2)}\right)}{x\left(1+x^{\ln(2)}\right)}$$
check its plot: