Tuesday, May 30, 2017

algebra precalculus - How to find $log{x}$ close to exact value in two digits with these methods?


I'm trying to find the result of $\log{x}$ (base 10) close to exact value in two digits with these methods:


The methods below are doing by hand. I appreciate you all who already give answers for computer method.


As suggested by Praktik Deoghare's answer



If number N (base 10) is n-digit then $$n-1 \leq \log_{10}(N) < n$$ Then logarithm can be approximated using $$\log_{10}(N) \approx n-1 + \frac{N}{10^{n} - 10^{n-1}}$$ Logarithm maps numbers from 10 to 100 in the range 1 to 2 so log of numbers near 50 is about 1.5. But this is only a linear approximation, good for mental calculation and toy projects but not that good for serious research.




This method is cool for me, but it's nearly close to exact value. $\log_{10}(53)$ is 1.7 and with that method results 1.58.


As suggested by Pedro Tamaroff's answer



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 \approx 1.098065476\dots$



This one is also cool for me, but it's to find natural logarithm, not base-10 logarithm.


As suggested by Kaleb's answer



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$$




The method is for calculating $ln(x)$, not $\log{x}$. I don't know the Taylor series for calculate $\log{x}$, especially when to find log result close to exact value in two digits (with similar method).


As suggested by Glenn's answer



The Wikipedia article "Generalized continued fraction" has a KhovanskiÄ­-based algorithm that differs only in substituting x/y for z, and showing an intermediate step: $$\log \left( 1+\frac{x}{y} \right) = \cfrac{x} {y+\cfrac{1x} {2+\cfrac{1x} {3y+\cfrac{2x} {2+\cfrac{2x} {5y+\cfrac{3x} {2+\ddots}}}}}} $$



This method is very slow for me. When I stop at $3y$, the result (log calculation) is still far from the exact value.


Anyone who can improve all of the above methods so I can precisely get log result close to exact value in two digits?


Answer



Listing a few tricks that work for mental arithmetic. Mostly to get the OP to comment, whether this is at all what they expect. I write $\log$ for $\log_{10}$ to save a few keystrokes.



You need to memorize a few logarithms and play with those. We all have seen $\log 2\approx 0.30103$ enough many times to have memorized it. Consequently by mental arithmetic we get for example the following $$ \begin{aligned} \log4&=2\log2&\approx 0.602,\\ \log5&=\log(10/2)&\approx 0.699,\\ \log1.6&=\log(2^4/10)&\approx 0.204,\\ \log1.024&=\log(2^{10})-3&\approx 0.0103.\\ \end{aligned} $$ Using these is based on spotting numerical near matches.


You should also be aware of the first order Taylor series approximation $$ \log(1+x)\approx\frac{x}{\ln 10}\approx\frac{x}{2.3}\approx0.434 x, $$ which implies (plug in $x=0.01$) that if you change the value of $x$ by 1 per cent, then its logarithm changes by approximately $0.0043$.


As an example let's do $\log 53$ and $\log7$. Here $x=53$ is $6\%$ larger than $50$, so a first order approximation would be $$ \log53\approx\log 50+6\cdot 0.0043=\log(10^2/2)+6\cdot0.00434\approx 2-0.30103+0.0258\approx1.725. $$ With $7$ we can spot that $7^2=49$ is $2\%$ less than $50$, so $$\log 7=\frac12\,\log49\approx\frac12(2-0.301-2\cdot0.0043)\approx\frac{1.690}2=0.845. $$ Here the third decimal of $\log53$ is off by one, but $\log7$ has three correct digits - both well within your desired accuracy.


No comments:

Post a Comment

analysis - Injection, making bijection

I have injection $f \colon A \rightarrow B$ and I want to get bijection. Can I just resting codomain to $f(A)$? I know that every function i...