# Taylor series expansion of base 2 logarithms

Sorry for the noob question, but I've been hitting my head against the wall on this for a while.

I am looking for a Taylor series expansion of a logarithm other than the natural logarithm $ln(x)$. It seems that every piece of literature I've been going through treats solely the natural logarithm and not logarithms in other bases.

In particular, I would like to know the Taylor series corresponding to the binary logarithm $log_2(x)$. For instance, how would I go about calculating $log_2(3)$ using the Taylor series?

Thanks!

• Since $\log_2(x)=(1/\ln 2)\cdot \ln(x)$ just multiply series by the constant. – coffeemath Dec 2 '12 at 14:14
• Thanks, that's exactly what I was looking for! Kind of obvious though... dunno how I missed it :) Add your comment as an answer and I will accept it! – Winston Dec 2 '12 at 16:13

$\log_2(x)$=$\ln(x)/\ln(2)$. Then expand the $\ln(x)$.

• Think you've formatted this incorrectly, and it is incorrect. – Simon Hayward Dec 2 '12 at 14:52

Find the Taylor series of $\log_2(x)=\frac{\ln(x)}{\ln(2)}$ at a point close to $x=3$, for instance $x=\frac{5}{2}$

$$\log_2(x)= \frac{1}{\ln(2)}\left(\ln \left( 5 \right) -\ln \left( 2 \right) +{\frac {2}{5}} \left( x -{\frac {5}{2}} \right) -{\frac {2}{25}} \left( x-{\frac {5}{2}} \right) ^{2}+{\frac {8}{375}} \left( x-{\frac {5}{2}} \right) ^{3}+O \left( \left( x-{\frac {5}{2}} \right) ^{4} \right)\right).$$ Now, subs $x=3$ in the above approximation series gives

$$\log_2(3)\sim 1.585460388$$

with absolute error

$$0.000497887.$$

Note: You can find the Taylor series at the point $x=e$ which makes the derivation easier

$$\log_2(x) \sim \frac{1}{\ln(2)} \left( 1+\frac{1}{e}(x-e)-\frac{1}{2e^2}(x-e)^2 + \frac{1}{3e^3}(x-e)^3\right).$$

Base conversion of $\ln(\cdot)$ is correct analytically, but, curiously, in error in binary computers. To see the actual recursively convergent expansion of the binary logarithm (the binary "equivalent" of the Taylor series), a good starting point is the Wiki article binary logarithm, and following its links and associated pages.

• What's your point, that fixed-point division to some arbitrary-precision value of (1/ln 2) is inexact? You haven't given an actual answer. Which specific link from the WP page? FYI the 32b binary value of 1/ln 2 ~ 1.10111000101010100011101100101001... – smci Sep 14 '16 at 3:10