# Logarithms

Up a level : Power Series
Previous page : Integrating and differentiating a series
Next page : Radius of convergence and interval of convergence

Since the ln(x) function is not defined for x=0, we cannot directly a series expansion around x=0. What we could do though is to shift the function one step, i.e. we will look at ln(1+x).

We get

 k f (k)(x) f (k)(0) 0 ln(1+x) 0 1 ${(1 + x)^{ - 1}}$${(1 + x)^{ - 1}}$ 0! 2 $-1 \cdot {(1 + x)^{ - 2}}$$-1 \cdot {(1 + x)^{ - 2}}$ –1! 3 $1 \cdot 2 \cdot {(1 + x)^{ - 3}}$$1 \cdot 2 \cdot {(1 + x)^{ - 3}}$ 2! 4 $-1 \cdot 2 \cdot 3 \cdot {(1 + x)^{ - 4}}$$-1 \cdot 2 \cdot 3 \cdot {(1 + x)^{ - 4}}$ –3! 5 … …

I.e. it continues as the series for (1+x)-1 but shifted one step. This would give us

$\begin{gathered} \ln (1 + x) = x - \frac{{1!}}{{2!}}{x^2} + \frac{{2!}}{{3!}}{x^3} - \frac{{3!}}{{4!}}{x^4} + ... \hfill \\ \quad \quad \quad \;\; = x - \frac{{{x^2}}}{2} + \frac{{{x^3}}}{3} - \frac{{{x^4}}}{4} + ... \hfill \\ \end{gathered}$

I.e. exactly what we got on the previous page.  From this we also get that

$\ln (1 + 1) = \ln 2 = 1 - \frac{1}{2} + \frac{1}{3} - \frac{1}{4} + ...$

And indeed if we add up more and more terms of the above series you get closer and closer to ln(2) that is about  0.6931472 . We need many terms though. A million of them get us 0.6931467. Ten million terms gives us 0.6931471. We need about 20 million terms to get the correct value with seven decimals.

Ok, we could first start with reducing the number we want to take the logarithm of by dividing it by a power of e big enough to scale it down to a number less than two.  We get that

$\begin{gathered} \ln (2) = \ln \left( {\frac{2}{e} \cdot e} \right) = \ln \left( {\frac{2}{e}} \right) + 1 \hfill \\ \quad \quad = \ln \left( {1 + \left[ {\frac{2}{e} - 1} \right]} \right) + 1 \hfill \\ \end{gathered}$

where the number in the square bracket is our new x, that would be about -0.26. In this case we would need about 10 terms to get seven correct decimals. Quite an improvement.

In practice we scale it down using powers of 2, since computers work with powers of 2.

Up a level : Power Series
Previous page : Integrating and differentiating a series