How to figure out the log of a number without a calculator?
I have seen people look at log (several digit number) and rattle off the first couple of digits.
I can get the value for small values (aka the popular or easy to know roots), but is there a formula. Similar to how to tell if a number is divisible by an integer.
I have read this and this but could some one explain why it works?
Solution 1:
The idea of the first article is to rewrite any positive number $x$ as :
$$\tag{1}x=m\cdot 10^{\,e}$$ with $m$ the 'mantissa' : a real number between $1$ and $10$ (excluded)
and $\,e\,$ the 'exponent' (or "power of ten") which is a signed integer.
From this we have $\;\tag{2}\log_{10}(x)= e+\log_{10}(m)$
(to keep notations short I'll write $\,\log(x)\,$ for $\,\log_{10}(x)\,$ and use $\,\ln(x)$ for the 'natural' logarithm)
Since the mantissa is between $1$ and $10$ the idea is to memorize the first logarithms (here I'll use up to $5$ digits, you may use fewer or more digits if you prefer) :
$$ \begin{array} {ll} m & \log\,m\\ 1 & 0\\ 2 & 0.30103\\ 3 & 0.47712\\ 4 & 0.60206\\ 5 & 0.69897\\ 6 & 0.77815\\ 7 & 0.84510\\ 8 & 0.90309\\ 9 & 0.95424\\ \end{array} $$
This seems to be much work but these values (except $\log(7)$) are not independent :
- $\log(2^n)=n\,\log(2)\;$ so that $\;\log(4)=2\log(2),\;\log(8)=3\log(2),\cdots$
- more generally $\;\log(a\cdot b)=\log(a)+\log(b)\;$ so that the table could be rewritten (using $\,1=\log(10)=\log(2)+\log(5)$) :
$$ \begin{array} {lll} m & \log\,m\\ 1 & 0\\ 2 & 0.30103 &\log(2)\\ 3 & 0.47712 &\log(3)\\ 4 & 0.60206 &2\,\log(2)\\ 5 & 0.69897 &1-\log(2)\\ 6 & 0.77815 &\log(2)+\log(3)\\ 7 & 0.84510 &\log(7)\\ 8 & 0.90309 &3\,\log(2)\\ 9 & 0.95424 &2\,\log(3)\\ \end{array} $$
The table may thus be rebuilt with just three values (two if $\,\log(7)\,$ is omitted)!
One should memorize too $\;\ln(10) \approx 2.3026\,$ and its multiplicative inverse $\;\dfrac{1}{\ln(10)}=\dfrac{\ln(e)}{\ln(10)}=\log(e)\approx \dfrac 1{2.3026}\approx 0.4343$.
The classical expansion $\;\ln(1+x)\approx x\;$ will be rewritten as :
$$\tag{3}\log(1+x)=\frac{\ln(1+x)}{\ln(10)}\approx 0.4343\cdot x$$
(with $x$ replaced by $\;x-\dfrac{x^2}2+\dfrac{x^3}3-\cdots\,$ if needed)
Let's apply all this to recover the (unfortunately lost...) value of $\,\log(7)\,$ using only $\;\log(2),\log(3),\log(e)$. One method is to use $\;\log(7)=\dfrac{\log(7^2)}2\;$ and :
\begin{align} \log(49)&=\log\left(50\;\left(1-\frac 1{50}\right)\right)\\ &=\log\left(\frac{100}2\right)+\log\left(1-\frac 1{50}\right)\\ &\approx\log(100)-\log(2)-0.4343\left(\frac 1{50}+\frac 1{2\cdot50^2}\right)\\ &\approx 2-\log(2)-\frac{0.8686}{100}\left(1+\frac 1{100}\right)\\ &\approx 2-0.30103-0.00877\\ &\approx 1.69020 \end{align}
Dividing by $2$ will indeed give the wished $0.84510$. Without the $\dfrac{x^2}2$ term we would get $\,0.84514$ : also not that bad! $$-$$
Let's further practice and compute $\log(29012)$ as in your article : $\log(29012)=\log(2.9012\cdot 10^4)=4+\log(2.9012)$
In first approximation we have $\;\log(2.9012) \approx \log(3) \approx 0.477\;$ and deduce that $\log(29012)\approx 4+0.477 \approx 4.477$.
we have $\;2.9012\approx 3\cdot 0.9671 \approx 3\cdot (1-0.0329)\;$ so that \begin{align} \log(2.9012)&\approx \log(3)+\log(1-0.0329)\\ &\approx 0.47712-0.434\cdot 0.033\\ &\approx 0.47712-0.0143\\ &\approx 0.4628 \end{align}
and we got $\;\log(29012)\approx 4.4628\,$ not so far from the exact $4.4625776\cdots$
It is important to understand that the table of logarithms allows too the reverse computation that is to compute $10^{\,x}$.
Of course $10^{\,\log(2)}=2$ so that for example $10^{\,0.3}$ will be just a bit smaller than $2$.
For additional precision and for $x\ll 1$ let's write the useful $\displaystyle 10^x=e^{x\ln(10)}\approx 1+\ln(10)x\;$ or $$\tag{4}10^{\,x}\approx 1+2.3026\cdot x$$
To compute $10^{\,x}$ decompose $x$ in its integer part $i$ and fractional part $f$ then $10^{\,i+f}=10^{\,i}\cdot 10^{\,f}$ : the mantissa of this result $10^{\,f}$ will be found using the table and $i$ will of course be the exponent.
After that all applications may follow : compute $a^b$ for any positive real $a$ and real $b$ using $\,\log(a^b)=b\,\log(a)\;$ so that
$$a^b=10^{\,b\log(a)}$$
Computing the $n$-th root of a positive real number will just be the special case $\;b=\dfrac 1n$.
Example $\sqrt[5]{1212}$ : \begin{align} 1212&\approx 3\cdot 4\cdot 100\cdot 1.01\\ \log(1212)&\approx 2+\log(3)+\log(4)+0.4343/100\\ \dfrac{\log(1212)}{5}&\approx \frac{2+0.47712+0.60206+0.00434}5\\ \approx 0.6167 \end{align} The answer (approximatively $10^{\,0.6167}$) will thus be a little over $4$.
More exactly $\,0.61670=0.60206+0.01464\,$ and since $\,10^{0.01464}\approx 1+2.3\cdot 0.0146 \approx 1.0336\;$ an approximate result will be $4\cdot 1.0336$ that is : $$\sqrt[5]{1212}\approx 4.134$$ while the exact result is $4.1371429\cdots$.
Many methods may be used to get more precision :
- from $1212=1200\cdot 1.01$ expand the logarithm (and/or the power of $10$) to second order as done for $\log(7)$
- compose (+ -) different exact values of logarithms to get values near the searched one (example $\,1.33\approx \dfrac 43$ and thus $\;\log(1.33)\approx \log(4)-\log(3)$)
- memorize values nearer to $1$ : $\log(1.1)\approx 0.041393,\ \log(1.2)=\log(\frac{3\cdot4}{10})\approx 0.07918$ and so on (you should nearly 'recognize' $\log(1.01)= 0.004321$... (see $\log(e)$) and won't need to memorize $\log(1.001)$)
- $\cdots$
Wishing you much fun discovering yourself other tricks,
Solution 2:
One can get very good approximations by using
$$\frac 1 2 \log \left|\frac{1+x}{1-x}\right| =x+\frac {x^3} 3+ \frac {x^5}5+\cdots$$
Say you want to get $\log 3$. Then take $x=1/2$. Then you get
$$\log 3 \approx 2\left( \frac 1 2 +\frac 1 {24} + \frac 1 {140} \right)=1.0976190\dots$$
The real value is $\log 3 = 1.098612289\dots$
Take another term to get
$\log 3 \approx 1.098065476\dots$.
Note that this particular series has the advantage that for $x < 1$ (which is where it works) you get "exponentially increasing" approximations.
Solution 3:
This can be done by recourse to Taylor series. For $\ln(x)$ centered at 1, i.e. where $0 < x \leq 2$: $$ \ln(x)= \sum_{n=1}^\infty \frac{(x-1)^n}{n}= (x-1) - \frac{1}{2}(x-1)^2 + \frac{1}{3}(x-1)^3 + \frac{1}{4}(x-1)^4 + \cdots $$
Solution 4:
A curve can be approximated with line segments.
If $4 \le x \lt 5$, then $\log(x) \approx 0.1(x+2)$. For example, $\log(4.1) \approx 0.61$, $\log(4.2) \approx 0.62$, $\log(4.3) \approx 0.63, \ldots, \log(4.9) \approx 0.69$.
If $7 \le x \lt 10$, then $\log(x) \approx 0.1(x/2 + 5)$. For example, $\log(7.2) \approx 0.1(7.2/2 + 5) \approx 0.86$.