What is the continued fraction representation of $\log a \over \log b$? Both $a, b$ are integers $>1$.

Wolfram gives expressions for $\log(1+z)$ as well as $\log({1+z\over1-z})$, but does not give any explanation for their derivation.

The Handbook of Continued Fractions for Special Functions is excellent but its exposition does not seem to help with the fact that there are two arguments to the expression, not one.

My goal is to produce successive rational approximations to $\log a \over \log b$. I could produce successive rational expressions for $\log a$ and $\log b$ independently and divide to produce an approximation to the ratio, but that approximation is not optimal. Some Mathematica tests using exhastive search for the first few ideal rational approximations show the ratio method is vastly inferior to the optimal answer that treats the values simultaneously.

  • $\begingroup$ Have you considered posting this on mathoverflow? $\endgroup$
    – cactus314
    Oct 26 '17 at 19:27
  • $\begingroup$ I'm not sure whether it helps or not. $$\log\left(\frac{1+z}{1-z}\right) = \log\left(1+\frac{2z}{1-z}\right)$$ $\endgroup$
    – Math Lover
    Oct 26 '17 at 19:28
  • $\begingroup$ Observing that $$\frac{\log a}{\log b}=\log_ba,$$ I think you will find this link somewhat interesting. $\endgroup$ Oct 26 '17 at 19:31

If you know how to get the simple continued fraction of $n/m$ using the subtractive extended Euclidean algorithm, you do essentially the same thing except instead of subtraction you use division. If you want to find good rational approximations to $\log x/\log y,$ use this algorithm.

First, initial values are $x_0 = x>1, y_0 = y>1.$ In step $n$ we have $x_n = x^{a_n}/y^{b_n},\; y_n = y^{d_n}/x^{c_n}.$ If $x_n=y_n$ then we stop since $x^{a_n+c_n}=y^{b_n+d_n}$ and $\log x/\log y=(b_n+d_n)/(a_n+c_n).$ Otherwise, suppose $x_n<y_n.$ Then let $x_{n+1}=x_n,\; y_{n+1}=y_n/x_n,\;$ and $\;y_{n+1}=y^{d_n+b_n}/x^{a_n+c_n}.$ So now we get that $a_{n+1}=a_n,\; b_{n+1}=b_n,\; c_{n+1}=c_n+a_n,\; d_{n+1}=d_n+b_n.$ Similarly if $x_n>y_n,$ with the roles of $x$ and $y$ reversed. For all $n$, $\;(b_n+d_n)/(a_n+c_n)\approx \log x/\log y=\log_y x.$

For an example, let $x=2,y=10.$ Then, $x_4=1.6=2^4/10^1,\; y_4=1.25=10^1/2^3$ giving $\log_{10}2 \approx (1+1)/(4+3)=2/7$ and next $x_5=1.28=2^7/10^2,\;y_5=1.25=10^1/2^3$ giving $\log_{10}2\approx (2+1)/(7+3)=3/10=.300.$ Next approximation is $4/13=.307\dots\;$ and so on.

(Note) Shanks' algorithm from 1954 is closely related except he finds just the simple continued fraction partial quotients. The algorithm I describe gives rational bounds at each stage using only one division per step. More precisely, $\;b_n/a_n<\log_yx<d_n/c_n\;$ for all $n$.

  • $\begingroup$ This is so simple and elegant.. clearly the right way to proceed. And now I have more to learn about the generalizations like Shanks' algorithm, thanks! $\endgroup$ Nov 1 '17 at 20:34
  • $\begingroup$ but this is no formular, it's a good algo for computer programs though $\endgroup$
    – athos
    May 9 '18 at 5:39

This is not quite an answer, but also way too big for a comment.

Euler made a powerful observation, that $a_0+a_0a_1+a_0a_1a_2+\dots+a_0a_1a_2\dots a_n$ equals

$$\cfrac{a_0}{1- \cfrac{a_1}{1+a_1- \cfrac{a_2}{1+a_2- \cfrac{\ddots}{\ddots- \cfrac{a_{n-1}}{1+a_{n-1}- \cfrac{a_n}{1+a_n}}}}}}$$

Using this and taking $n\to\infty$, one can show that if $x=1+\sum_{i=1}^{\infty}\left(\prod_{j=1}^ia_i\right)$ then

$$x=\cfrac{1}{1- \cfrac{a_1}{1+a_1- \cfrac{a_2}{1+a_2- \cfrac{a_3}{1+a_3-\ddots}}}}$$

This, together with an application of an equivalence transformation, is what's behind Euler's celebrated continued fraction representation for $e^z$ $(z>0)$:


The expression for $\log\left(\frac{1+z}{1-z}\right)$ comes from the power series


using the same principle as above. Indeed, we can write

\begin{align} \log\left(\frac{1+z}{1-z}\right) &=2z\left(1+\frac{z^2}3+\frac{z^4}5+\dots\right)\\ &=2z\left(1+\frac{z^2}3+\frac{z^2}{3}\frac{z^2}{5/3}+\dots\right) \end{align}

and apply an equivalence transformation at the end to tidy things up.

The continued fraction representation for $\log(1+z)$ is a bit more complicated. It comes from Gauss's continued fraction representations for hypergeometric functions. Indeed, for $|z|<1$ we have

\begin{align} \log(1+z)=\sum_{n=1}^\infty \frac{(-1)^{n-1}}nz^n &=z\sum_{m=0}^\infty \frac{(-1)^m}{m+1}z^m\\ &=z\sum_{m=0}^\infty\frac{(-z)^m}{m!}\frac{(1)_m(1)_m}{(2)_m}\\ &=z\,\,{}_2F_1(1,1,;2;-z) \end{align}

This yields a continued fraction representation for $\log(1+z)$ that is still valid outside of the branch cut, ie, outside $(-\infty,-1)$.

If you don't mind $\log b$ showing up, there's an obvious formula. Taking $a^*=a-1$ we get that $\frac{\log a }{\log b}=\frac1{\log b} \log(1+a^*)$ must equal

\begin{align} \frac1{\log b}\cdot &\cfrac{a^*}{1+ \cfrac{a^*}{2+ \cfrac{a^*}{3+ \cfrac{4a^*}{4+ \cfrac{4a^*}{5+ \cfrac{9a^*}{6+ \cfrac{9a^*}{7+\ddots}}}}}}}\\ =&\cfrac{a^*}{\log b+ \cfrac{a^*\log b}{2+ \cfrac{a^*}{3+ \cfrac{4a^*}{4+ \cfrac{4a^*}{5+ \cfrac{9a^*}{6+ \cfrac{9a^*}{7+\ddots}}}}}}} \end{align}

If you're not happy with $\log b$ showing up near $a^*$, you can instead write

\begin{align} &\cfrac{a^*}{\log b+\frac1{\frac1{\log b}}\cdot \cfrac{a^*}{2+ \cfrac{a^*}{3+ \cfrac{4a^*}{4+ \cfrac{4a^*}{5+ \cfrac{9a^*}{6+ \cfrac{9a^*}{7+\ddots}}}}}}}\\ = &\cfrac{a^*}{\log b+ \cfrac{a^*}{\frac{2}{\log b}+ \cfrac{a^*}{3\log b+\frac1{\frac1{\log b}}\cdot \cfrac{4a^*}{4+ \cfrac{4a^*}{5+ \cfrac{9a^*}{6+ \cfrac{9a^*}{7+\ddots}}}}}}} \end{align}

Proceeding in this manner, we get

$$\cfrac{a^*}{\log b+ \cfrac{a^*}{\frac{2}{\log b}+ \cfrac{a^*}{3\log b+ \cfrac{4a^*}{\frac4{\log b}+ \cfrac{4a^*}{5\log b+ \cfrac{9a^*}{\frac6{\log b}+ \cfrac{9a^*}{7\log b+\ddots}}}}}}}$$

  • $\begingroup$ Indeed, too big for a comment. It sure gives excellent intuition and a flavor for manipulating these infinite sequences. Thanks! $\endgroup$ Nov 1 '17 at 20:36

If $a = b+z $ with $|z| < b$, then you can write $$ \dfrac{\log(b+z)}{\log(b)} = 1 + \dfrac{z}{b \log b + \dfrac{z}{ \frac{2}{\log (b)} + \dfrac{z}{3 b \log(b) + \dfrac{z}{ \frac{2}{2\log (b)} + \dfrac{z}{5 b \log(b) + \dfrac{z}{ \frac{2}{3\log(b)} + \ldots}}}}}}$$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.