<s>[INST] Frullani version of the classic $\log \left( 1 + 2\alpha \cos px + \alpha^2\right)$ integral. I read in a paper about Frullani integrals the following claim
$$ 
\begin{align*}
I & :=\int_0^\infty \frac{1}{x}\log\left(\frac{1 + 2\alpha \cos px + \alpha^2}{1 + 2\alpha \cos qx + \alpha^2}\right)\,\mathrm{d}x  
     =
\left\{ 
   \begin{array}{lrr} 
          \log \frac{p}{q} \log\left( 1 + \alpha^2\right)         & \text{if} & \alpha^2>1\\
          \log \frac{p}{q} \log\left( 1 + \frac{1}{\alpha}\right) & \text{if} & \alpha^2<1
   \end{array} 
\right.
\end{align*}
$$
Where the author points at the dangers of using this method. The problem
lies in the fact that the function $f(n,r) := \log(1+2n \cos rx + n^2)$ does not have a limit
as $x\to \infty$. And hence the Frullani identity can not be used. 
A very similar integral $f(n,-r)$ has been evaluated several times before. 
See for an example A question in Complex Analysis $\int_0^{2\pi}\log(1-2r\cos x +r^2)\,dx$
and can also be solved by differentiating under the integral sign . Even $f(n,-r)^2$ has been evaluated. 
My question is: Can any of this be used to prove the claim above? 
 [/INST] Untilize the Frullani-like integral
$\int_0^\infty \frac{\cos px -\cos qx}xdx
=\ln\frac qp$
to obtain
\begin{align}
I_{a^2<1}= &\int_{0}^{\infty} \frac{1}{x} \,  \ln \frac{1+2a\cos px+a^{2}}{1+2 a\cos qx + a^{2}} \ dx\\
=&\> 2 \int_{0}^{\infty} 
\sum_{k=1}^\infty \frac{(-a)^{k+1}}{k}\frac{\cos(k px)-\cos(k qx)}x \ dx\\
= &\>2\ln \frac qp \sum_{k=1}^\infty \frac{(-a)^{k+1}}{k}
= 2\ln \frac qp \ \ln(1+a)
\\
\\
I_{a^2>1}=&\int_{0}^{\infty} \frac{1}{x} \,  \ln \frac{1+\frac2a\cos px+\frac1{a^2}}{1+\frac2a\cos qx+\frac1{a^2}} \ dx
= 2\ln \frac qp \ \ln(1+\frac1a)
\end{align}
</s>