Knowing Lady L

Let us turn our attention to the numerical calculation of logarithm, introduced in my previous post “Introducing Lady L“.

An example of naively compute log(x), based solely on its definition is shown in Fig. 1.

Screen Shot 2017-10-03 at 9.42.37 PM.png

Fig. 1

However, a more explicit expression is better suited for this purpose.

Screen Shot 2017-10-07 at 6.12.01 PM.png

Fig. 2

From Fig.2, geometrical Interpretation of \log(1+x) as the shaded area reveals that

\log(1+x) = \int\limits_{1}^{x+1}{1 \over s}\;ds

=\int\limits_{1}^{s^*}{1 \over s}\;ds=\int\limits_{0}^{t^*}{1 \over {1+t}}\;dt

=\int\limits_{0}^{s^*-1}{1 \over {1+t}}\;dt = \int\limits_{0}^{(x+1)-1}{1 \over {1+t}}\;dt =\int\limits_{0}^{x}{1 \over {1+t}}\;dt,


\log(1+x) = \int\limits_{0}^{x}{1 \over {1+t}}\;dt\quad\quad\quad(1)

Inserting into (1) the well known result

{1 \over {1+x}} =\sum\limits_{i=1}^{n}{(-1)^{i-1}x^{i-1} + {{(-1)^n x^n} \over {1+x}}},

we obtain

\log(1+x)=\int\limits_{0}^{x} \sum\limits_{i=1}^{n}{(-1)^{i-1}t^{i-1} + {{(-1)^n t^n} \over {1+t}}}\; dt

= \int\limits_{0}^{x}\sum\limits_{i=1}^{n}{(-1)^{i-1}t^{i-1}\;dt +\int\limits_{0}^{x}{{(-1)^n t^n} \over {1+t}}}\;dt

=\sum\limits_{i=1}^{n}{(-1)^{i-1}\int\limits_{0}^{x}{t^{i-1}}\;dt}+\int\limits_{0}^{x}{{(-1)^n t^n} \over {1+t}}\;dt

= \sum\limits_{i=1}^{n}{{(-1)^{i-1}x^i} \over {i}} + \int\limits_{0}^{x}{{(-1)^n t^n} \over {1+t}}\;dt.


r_n= \int\limits_{0}^{x}{{(-1)^n t^n}\over{1+t}}\;dt,

we have

\log(1+x)-r_n=\sum\limits_{i=1}^{n}{{(-1)^{i-1} x^i}\over{i}}.

If -1<x<0,

|r_n| = |-\int\limits_{x}^{0}{{(-1)^n t^n}\over{1+t}}\;dt|\leq \int\limits_{x}^{0}|{{(-1)^{n}{t^n}} \over {1+t}}|\;dt=\int\limits_{x}^{0}{{|t|^n} \over {1+t}}\;dt\leq |x|^n\int\limits_{x}^{0}{1 \over {1+t}}\;dt

otherwise (0 \leq x < 1)

|r_n|\leq \int\limits_{0}^{x}|{{(-1)^{n}{t^n}} \over {1+t}}|\;dt=\int\limits_{0}^{x}{{|t^n|} \over {1+t}}\;dt\leq |x|^n\int\limits_{0}^{x}{1 \over {1+t}}\;dt .

Therefore, either

-|x|^n\int\limits_{x}^{0}{1 \over {1+t}}\;dt \leq r_n \leq |x|^n\int\limits_{x}^{0}{1 \over {1+t}}\;dt


-|x|^n\int\limits_{0}^{x}{1 \over {1+t}}\;dt \leq r_n \leq |x|^n\int\limits_{0}^{x}{1 \over {1+t}}\;dt.

Since |x| < 1,

\lim\limits_{n \to \infty}-|x|^n\int\limits_{0}^{x}{1 \over {1+t}}\;dt=0


\lim\limits_{n \to \infty}|x|^n\int\limits_{0}^{x}{1 \over {1+t}}\;dt=0

We conclude that

\lim\limits_{n\to\infty}r_n = 0.

As a consequence,

\log(1+x) = \log(1+x)-0

= \lim\limits_{n\to\infty}\log(1+x)-\lim\limits_{n \to \infty}r_n


=\lim\limits_{n\to\infty}( \sum\limits_{i=1}^{n}{{(-1)^{i-1}x^i} \over {i}}),


\log(1+x) = \sum\limits_{i=1}^{\infty}{{(-1)^{i-1}x^i} \over {i}}\quad\quad(2)

(2) offers a means for finding the numerical values of logarithm. However, its range is limited to the value of 1+x between 0 and 2, since -1<x<1 \implies 0 < 1+x < 2.

To overcome this limitation, we proceed as follows:

\forall x \in (-1, 1), -x \in (-1, 1). By (2),

\log(1-x)=\log(1+(-x)) = \sum\limits_{i=1}^{\infty}{{(-1)^{i-1}(-x)^i} \over i }= \sum\limits_{i=1}^{\infty}{{-x^i} \over {i}}


\log(1-x) = \sum\limits_{i=1}^{\infty}{{-x^i} \over {i}}\quad\quad\quad\quad(3)

Subtracting (3) from (2) and using the fact that \log{a}-\log{b}=\log{a \over b}, we have

\log{{1+x} \over {1-x}} = \sum\limits_{i=1}^{\infty}{{(-1)^{i-1}x^i} \over {i}} - \sum\limits_{i=1}^{\infty}{{-x^i} \over {i}}

= \sum\limits_{i=1}^{\infty}{{(-1)^{i-1}{x^i} \over {i}} + {{x^i} \over {i}}}

=\sum\limits_{odd \;i=1}^{\infty}{2{x^i} \over {i}}.


\log{{1+x} \over {1-x}} = 2\sum\limits_{i=1}^{\infty}{{x^{2i-1}} \over {2i-1}}\quad\quad\quad(4)

Solving equation

{{1+x} \over {1-x}} = v where v > 0 ,

we find

x = {{v-1} \over  {v+1}} .

Since this solution can be expressed as

x = {{-1-v+2v} \over {v+1}} = -1 + {2v \over {v+1}}


x = {{v+1-2} \over  {v+1}} = 1-{{2v} \over {v+1}}.

It shows that for any v > 0, x \in (-1, 1). Therefore,  (4) can be used to obtain the logarithm of any positive number. For example, to obtain \log(3), we solve {{1+x} \over {1-x}} = 3 first and then compute a partial sum of (4) with sufficient large number of terms (see Fig. 3)

Screen Shot 2017-10-02 at 9.30.37 PM.png

Fig. 3