Monday 15 April 2013

logarithms - Approximating Logs and Antilogs by hand




I have read through questions like Calculate logarithms by hand and and a section of the Feynman Lecture series which talks about calculation of logarithms.
I have recognized neither of them useful for my purpose which is to quickly calculate logarithms of base $10$ upto $4$ digit accuracy
(I believe 4 is the goldilocks number in this case) .



I wish to find things like $\log_{10}(2) \approx 0.3010$ quickly without using a calculator or log table. Why? Because I want to be free from carrying them around and losing them all day. Plus, they're not always available when I need them (you can guess why).
My main purpose is to approximate the answers of very large and very small results of time consuming calculations.
Logarithms make that job much easier for me. For example,



$$\frac{87539319}{1729} \approx 10^{7.942 - 3.237} = 10^{4.705} = 5.069*10^4$$




According to Wolfram (Yup, I'm that lazy) the answer is, $50630.0\overline{283400809716599190}$.
Yes, I've over estimated by around $60$ but thanks to a log table, I did that approximation as fast as it took Wolfram to load the precise answer in my browser. But, without a log table, dividing itself would have me executing an iterative convergence just to find the multiples.
(1729*2 = too low, 1729*8= too high ... this must be so intuitive for most of you)



So, a quick approximation method for logarithms would be really helpful to me.



Also, a good way to find antilogs will be nice as well.
I just realized that I can't compute decimal powers.
$$\Large 10^{0.3010} = 10^{0.3}*10^{0.001} = \sqrt[10]{1000} * \sqrt[1000]{10} = \text{Calculator Required}$$
I checked "
How to calculate a decimal power of a number"

but alas, the thing which came closest to what I needed required a calculator for an intermediate step. Defeats the purpose, I know.
If I can't find the antilog, the whole point of having a quick way to find the logarithm would be lost.

I hope you can help.


Answer



To give an approximation for at least $4$ digits in general by hand I think it is almost impossible. If you know some results from approximation theory after that you can appreciate logarithm tables.



Of course the first idea is the Taylor expansion for few terms. We know that for $|x| \leq 1$ and $x \neq -1$ the series for $\ln(1+x)$ is the following.
$$
\ln(1+x)=\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n} x^n = x - \frac{x^2}{2} + \frac{x^3}{3} - \cdots
$$

You can "run it" by hand from $n=1 \dots 3$ and for $\ln(2)$ you get $0.8333333333$. The correct value for $\ln(2)$ is $0.6931471806$. So the problem is behind the rate of convergence. There are also importent domain restrictions for this method.



For small $x$ values we also know that $\log(x) \approx \frac{x^x-1}{x}$ and $\log(1+x) \approx x$. Which is also not a good approximation but we can use it for values less then $1$. With logarithm identitiy-tricks you can make it more accurate, but we have better solutions.



Now take a look at inequalities. We have that for all $x>0$:
$$1-\frac{1}{x} \leq \ln x \leq x-1.$$
Or we can write it to the form for all $x>-1$:
$$\frac{x}{1+x} \leq \ln(1+x) \leq x.$$



We know other inequalities, and I think it is a good approach by hand, so let me introduce Henri Padé and his Padé approximant. With this method you can give lower and upper bounds for a function with rational functions. We will call lower bound $\phi_n$ and upper $\psi_n$, and here $n$ is the order of the approximation. You can read about approximate $\ln(1+x)$ with this method in this really good paper, or in this website.

So we have
$$\phi_n(x) \leq \ln(1+x) \leq \psi_n(x)$$
for $x \in [0,\infty[$ and for each $n$.



We will take order $n=3$, because I think this two rational funcion is what we can handle by hand. If you are good at mental calculation and you can memorize functions easily, you can take higher orders from the paper I refered above.
So for the lower bound $\phi_3$ we get
$$\phi_3(x)=\frac{x(60+60x+11x^2)}{3(20+30x+12x^2+x^3)},$$
and for the upper bound $\psi_3$ we get
$$\psi_3(x)=\frac{x(30+21x+x^2)}{3(10+12x+3x^2)}.$$




To evaulate this two functions by hand you need just to add, multiply, divide, and take integer power of a number.



To see how accuare this method I give you some results.




  • $\phi_3(1) = 0.6931216931 \leq \ln(2) = 0.6931471806 \leq 0.6933333333 = \psi_3(1),$

  • $\phi_3(2) = 1.098039216 \leq \ln(3) = 1.098612289 \leq 1.101449275 = \psi_3(2),$

  • $\phi_3(3) = 1.383673469 \leq \ln(4) = 1.386294361 \leq 1.397260274 = \psi_3(3),$

  • $\phi_3(4) = 1.602693603 \leq \ln(5) = 1.609437912 \leq 1.635220126 = \psi_3(4),$

  • $\phi_3(9) = 2.246609744 \leq \ln(10) = 2.302585093 \leq 2.493074792 = \psi_3(9),$


  • $\phi_3(50) = 3.254110231 \leq \ln(51) = 3.931825633 \leq 7.357172215 = \psi_3(50).$



Of course because the method works for smaller $x$ values better, if you have large $x$, then you could combine Padé approximant with logarithmic identities. For example $51$ has the prime factors $3$ and $17$, because of that we can write $\ln(51)$ into the form $\ln(51)=\ln(3)+\ln(17)$ so
$$\phi_3(50) \leq \phi_3(2)+\phi_3(16) = 3.766096945 \leq \ln(51)$$
is a better lower bound, and
$$\ln(51) \leq \psi_3(2)+\psi_3(16) = 4.521380547 \leq \psi_3(50)$$
is a better upper bound.



This is also a good approach to get approximation for $\log_b(x)$. For example for $\log_{10}(2) = \ln(2) / \ln(10) = 0.3010299957$ we can say it is somewhere between $\psi_3(1) / \psi_3(9) = 0.2781037037$ and $\phi_3(1) / \phi_3(9) = 0.3085189562$.




And at last if you get an $n=5$ order Padé approximant and use logarithmic identities then you get the following approximation for $\log_{10}(2)$ with $\phi_5$.



$$\frac{\phi_5(1)}{\phi_5(1)+\phi_5(4)} = 0.3010494871,$$



which is correct for the first $4$ digits.



You can approximate exponential function with this method too. Read about it in this paper, or in this MathOverflow answer!


No comments:

Post a Comment

real analysis - How to find $lim_{hrightarrow 0}frac{sin(ha)}{h}$

How to find $\lim_{h\rightarrow 0}\frac{\sin(ha)}{h}$ without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...