I want to know if there is a way to find for example $\ln(2)$, without using the calculator ?
Thanks
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It only takes a minute to sign up.
Sign up to join this communityI want to know if there is a way to find for example $\ln(2)$, without using the calculator ?
Thanks
$$\log 2 = 1-\frac{1}{2}+\frac{1}{3}-\frac{1}{4}+\ldots$$ In the general case $$\log \frac{1+x}{1-x} = 2(x+\frac{x^3}{3}+\frac{x^5}{5}+\frac{x^7}{7}+\ldots)$$
How precise do you need the calculation to be?
As a quick and dirty approximation, we know that $2^3 = 8$ and $e^2 \approx 2.7^2 = 7.29$, and so $\ln(2)$ should be just over $\frac{2}{3} \approx 0.67$. Contiuing to match powers, we find $2^{10} = 1024$, and $e^7 \approx (2.7)^7 = (3 - 0.3)^7 = 3^7 -7(3)^6(.3) + 21(3)^5(.3)^2 - 35(3)^4(.3)^3 \dots$ $= 3^7 (1 - .7 + .21 - .035 \dots)$ $\approx 2187(.475) = 1038.825$. Therefore, $e^7 \approx 2^{10}$ and so $\ln(2)$ should be just under $0.7$.
The operations that are relatively easy to compute by hand are addition, multiplication, and their inverses, subtraction, and division. With these operations we can compute all rational functions, e.g. $\frac{2x^2-1}{x^3+x-1}$.
We know that $$\ln(x)=\sum_{k=1}^{\infty}(-1)^k\frac{(x-1)^k}{k}$$
for values of $x$ close to $1$. So, if we take partial sums of this series we get approximations to logarithm that only require multiplications and sum and subtractions.
Notice that we only need to be able to compute values of logarithm for numbers close to $1$, since using $\ln(e^kx)=k+\ln(x)$ can allow us to reduce to this case.
$$\log2=\frac{2}{3}\left(1+\frac{1}{27}+\frac{1}{405}+\frac{1}{5103}+\frac{1}{59049}+\frac{1}{649539}+...\right)$$
The denominator is $(2k+1)9^k$.
Gourdon and Sebah discuss the efficiency of this formula in http://plouffe.fr/simon/articles/log2.pdf (page 11)
A "little more effort" is required to compute $log(2)$ using this formula than to compute $\pi$ using Machin's relation.
$$\log (x)=\sum _{n=1}^{\infty } \frac{\left(\frac{x-1}{x}\right)^n}{n}$$ when $x>1$
We have the CORDIC method, which can be quite effective for by-hand computation as it requires additions/subtractions only (an one multiply by a small integer).
There are two limitations though:
it is better performed in base $2$, so a preliminary change of base is needed for the input argument (you can do it in base $10$ as well but it takes about $3$ times more operations);
you need a small table of constants.
It is based on the identity $\log(ab)=\log(a)+\log(b)$.
You first normalize the binary number as $x=z\cdot2^e$, with $1\le z<10_b$. You have $\log(x)=\log(z)+e\cdot\log(2)$.
Then $$\log(z)=\log(0.11_bz)-\log(0.11_b)\\ \log(z)=\log(0.111_bz)-\log(0.111_b)\\ \log(z)=\log(0.1111_bz)-\log(0.1111_b)\\ \cdots$$
You will use these equalities as follows. Initialize an accumulator $l\leftarrow0$ and
if $0.11_bz>1$ (i.e. $z>1.01010101_b\cdots$) let $z\leftarrow 0.11_bz$, $l\leftarrow l-\log(0.11_b)$;
if $0.111_bz>1$ (i.e. $z>1.00100100_b\cdots$) let $z\leftarrow 0.111_bz$, $l\leftarrow l-\log(0.111_b)$;
if $0.1111_bz>1$ (i.e. $z>1.00010001_b\cdots$) let $z\leftarrow 0.1111_bz$, $l\leftarrow l-\log(0.1111_b)$;
$\cdots$
The multiplies are actually performed as shifts and subtractions (f.i. $0.111_bz=z-0.001_bz$).
This way, we progressively reduce $z$ to bring it closer and closer to $1$, while $l$ gets closer and closer to the logarithm of the initial $z$. On every step we gain one bit of accuracy.
The table of constants ($\log(10_b)=-\log(0.1_b),-\log(0.11_b),-\log(0.111_b),\cdots$ up to the desired number of significant bits) is computed in the decimal base, so that the answer is readily available as such.
$$\begin{align}z&\to-\log(z)\\ 0.1000000000000000000000000000000_b&\to 0.6931471806_d\\ 0.1100000000000000000000000000000_b&\to 0.2876820725_d\\ 0.1110000000000000000000000000000_b&\to 0.1335313926_d\\ 0.1111000000000000000000000000000_b&\to 0.0645385211_d\\ 0.1111100000000000000000000000000_b&\to 0.0317486983_d\\ 0.1111110000000000000000000000000_b&\to 0.0157483570_d\\ 0.1111111000000000000000000000000_b&\to 0.0078431775_d\\ 0.1111111100000000000000000000000_b&\to 0.0039138993_d\\ 0.1111111110000000000000000000000_b&\to 0.0019550348_d\\ 0.1111111111000000000000000000000_b&\to 0.0009770396_d\\ 0.1111111111100000000000000000000_b&\to 0.0004884005_d\\ 0.1111111111110000000000000000000_b&\to 0.0002441704_d\\ 0.1111111111111000000000000000000_b&\to 0.0001220778_d\\ 0.1111111111111100000000000000000_b&\to 0.0000610370_d\\ 0.1111111111111110000000000000000_b&\to 0.0000305180_d\\ 0.1111111111111111000000000000000_b&\to 0.0000152589_d\\ 0.1111111111111111100000000000000_b&\to 0.0000076294_d\\ 0.1111111111111111110000000000000_b&\to 0.0000038147_d\\ 0.1111111111111111111000000000000_b&\to 0.0000019074_d\\ 0.1111111111111111111100000000000_b&\to 0.0000009537_d\\ 0.1111111111111111111110000000000_b&\to 0.0000004768_d\\ 0.1111111111111111111111000000000_b&\to 0.0000002384_d\\ 0.1111111111111111111111100000000_b&\to 0.0000001192_d\\ 0.1111111111111111111111110000000_b&\to 0.0000000596_d\\ 0.1111111111111111111111111000000_b&\to 0.0000000298_d\\ 0.1111111111111111111111111100000_b&\to 0.0000000149_d\\ 0.1111111111111111111111111110000_b&\to 0.0000000075_d\\ 0.1111111111111111111111111111000_b&\to 0.0000000037_d\\ 0.1111111111111111111111111111100_b&\to 0.0000000019_d\\ 0.1111111111111111111111111111110_b&\to 0.0000000009_d\\ 0.1111111111111111111111111111111_b&\to 0.0000000005_d\\ \end{align}$$
One can use the fact that
$$
\log x=\lim_{n\to\infty}n\left(1-\frac{1}{\sqrt[n]{x}}\right)
$$
For $\log2$ a good approximation is
$$
1048576\left(1-\frac{1}{\sqrt[1048576]{2}}\right)
$$
where
$$
\sqrt[1048576]{x}
$$
can be computed by pressing twenty times the SQRT
key on a pocket calculator, since $1048576=2^{20}$ (or computing it by hand, with much patience and time to spend).
What I get doing those computations is $0.6931469565952$, while a real computer gives $0.69314718055994530941$, so we have five exact decimal digits. Of course bigger numbers won't do, since the $2^{20}$-th root of it will be too near $1$ and the necessary digits would have already been lost.
(Note: $\log$ is the natural logarithm; I refuse to denote it in any other way. ;-)
)
;-)
For this you need a pocket calculator with the four operations and the square root, not a full fledged calculator. With only four square roots ($n=16$) I get $0.67834750882272$; with eight ($n=256$) it's $0.69220964211968$. This is easier than using the Taylor expansion. Completely by hand: Taylor in the form $\log\frac{1+x}{1-x}$
$\endgroup$
We can represent the logarithm of positive rational numbers as follows.
First, consider the following null conditionally convergent series (cancelled harmonic series):
$$0=(1-1)+\left(\frac{1}{2}-\frac{1}{2}\right)+\left(\frac{1}{3}-\frac{1}{3}\right)+\left(\frac{1}{4}-\frac{1}{4}\right)+\left(\frac{1}{5}-\frac{1}{5}\right)+...$$
Note that we are computing $0=\log(1)=\log\left(\frac{1}{1}\right)$ by adding consecutive terms with 1 positive fraction and 1 negative fraction each, taken from the inverses of non-zero integers. This observation may sound trivial now, but it is interesting for what comes next.
We can rearrange the terms of this series to compute $\log(2)$ by taking two positive fractions and one negative for each term.
$$\log\left(2\right)=\left(1+\frac{1}{2}-1\right)+\left(\frac{1}{3}+\frac{1}{4}-\frac{1}{2}\right)+\left(\frac{1}{5}+\frac{1}{6}-\frac{1}{3}\right)+\left(\frac{1}{7}+\frac{1}{8}-\frac{1}{4}\right)+...$$
This can be easily seen to be the Mercator series in disguise, so we have discovered nothing new yet.
But there is more. Similarly, we have
$$\log\left(3\right)=\left(1+\frac{1}{2}+\frac{1}{3}-1\right)+\left(\frac{1}{4}+\frac{1}{5}+\frac{1}{6}-\frac{1}{2}\right)+\left(\frac{1}{7}+\frac{1}{8}+\frac{1}{9}-\frac{1}{3}\right)+\left(\frac{1}{10}+\frac{1}{11}+\frac{1}{12}-\frac{1}{4}\right)+...$$
This pattern holds for all positive integers, so the next step is applying the property that $\log(p/q)=\log(p)-\log(q)$ on these representations.
This leads to $\log(p/q)$ by adding $p$ positive fractions and $q$ negative fractions at each step. For example, we have
$$\log\left(\frac{3}{2}\right)=\left(1+\frac{1}{2}+\frac{1}{3}-1-\frac{1}{2}\right)+\left(\frac{1}{4}+\frac{1}{5}+\frac{1}{6}-\frac{1}{3}-\frac{1}{4}\right)+\left(\frac{1}{7}+\frac{1}{8}+\frac{1}{9}-\frac{1}{5}-\frac{1}{6}\right)+...$$
as illustrated in http://oeis.org/A166871.
See also Do these series converge to logarithms? and Series for logarithms for further discussion of generalized Mercator series.
What you can use is the Taylor expansion of $\ln (1+x)$:
$$\ln (1+x) = \sum_{j=1}^\infty (-1)^{j+1}{x^j\over j}$$
which converges for $-1<x\le1$. It would be tempting to insert $x=1$ into it, but that would be a poor choice since the convergence for $x=1$ is painfully slow. Instead you use the fact that $\ln 2 = -\ln 1/2$ and insert $x=-1/2$ instead:
$$\ln (1-{1\over 2}) = \sum_{j=1}^\infty (-1)^{j+1}{1\over j2^j} = -\sum_{j=1}^\infty{1\over j2^j}$$
So
$$\ln 2 = \sum_{j=1}^\infty {1\over j2^j}$$
This is similar to how the calculator does it, but there's probably a few tricks more that's used. First it probably uses base two logarithm and have a stored value of $\lg_2 e$ to be able to produce the natural logarithm. The reason for this is to be able to handle logarithm of values outside the convergence region (and generally we want to use the series for as narrow region as possible). We generally can write any number on the form $x2^p$ (in fact the numbers are already represented on that form) with $x$ being near $1$ and then $\lg_2(x2^p) = p\lg_2(x)$ (similar trick is being done on all these kind of functions).
The second trick is to approximate $\ln(1+x)$ on the interval $[1/\sqrt2, \sqrt2]$ even better than Taylor expansion, the trick is to find a polynomial that approximates it as uniformly good as possible. The McLaurin expansion has the property that it will yield a good approximation fast for values near zero at the expense of values further away. For generic case one uses a polynomial that yields a good enough approximation equally fast in the interval.