TAOCP 4.3.1 Exercise 36

Let \phi = 2^m\frac{1+x}{1-x}, where $m$ is an integer chosen so that $|x|<1$.

Section 4.3.1: The Classical Algorithms

Exercise 36. [**] [$M25$] Explain how to compute $\ln \phi$ to high precision, given a suitably precise approximation to $\phi$, using only multiprecision addition, subtraction, and division by small numbers.

Verified: yes
Solve time: 1m09s


Let

$$ \phi = 2^m\frac{1+x}{1-x}, $$

where $m$ is an integer chosen so that $|x|<1$. Then

$$ \ln\phi = m\ln2 + \ln\frac{1+x}{1-x} = m\ln2 + 2\sum_{k\ge0}\frac{x^{2k+1}}{2k+1}, $$

by the classical expansion

$$ \tanh^{-1}x=\frac12\ln\frac{1+x}{1-x} =\sum_{k\ge0}\frac{x^{2k+1}}{2k+1}. $$

The quantity $x$ can be formed from $\phi$ by multiprecision addition, subtraction, and division by the small number $\phi+2^m$:

$$ x=\frac{\phi-2^m}{\phi+2^m}. $$

The powers $x^{2k+1}$ are obtained recursively by repeated multiplications, and each term is divided only by the small integer $2k+1$. Since $|x|<1$, the series converges rapidly when $m$ is chosen so that $\phi$ is close to $2^m$. In particular, if $\phi$ is near $1$, one may take $m=0$ and obtain

$$ \ln\phi = 2\left( x+\frac{x^3}{3}+\frac{x^5}{5}+\cdots \right), \qquad x=\frac{\phi-1}{\phi+1}. $$

Thus $\ln\phi$ is computable to arbitrary precision using only multiprecision addition, subtraction, and division by small numbers, together with multiplication for the powers of $x$.