<s>[INST] Calculate the line integral $I(a,b)=\int_{x^2+y^2=R^2}\limits\ln\frac{1}{\sqrt{(x-a)^2+(y-b)^2}} ds\quad(a^2+b^2\ne R^2).$ Calculate the line integral $$I(a,b)=\int_{x^2+y^2=R^2}\limits\ln\frac{1}{\sqrt{(x-a)^2+(y-b)^2}} ds\quad(a^2+b^2\ne R^2).$$
The parametrized integral path can be given as
$$x=R\cos t,y=R\sin t,t\in[0,2\pi].$$
Then I get into trouble when computing the integral
$$-\frac{1}{2}\int_{0}^{2\pi}R\ln(a^2+b^2+R^2-2aR\cos t-2bR\sin t) dt.$$
Should I take the derivative with respect to $R$ first? Or apply integration by parts?
Update: I find the offered answer is
$$I(a,b)=-2\pi R\ln\max\{R,\sqrt{a^2+b^2}\}$$
and I have examined its correctness.
 [/INST] As noted in @Dattier answer,
\begin{align}
I&=-\frac{1}{2}\int_{0}^{2\pi}R\ln(a^2+b^2+R^2-2aR\cos t-2bR\sin t) dt\\
&=-\frac{1}{2}\int_{0}^{2\pi}R\ln(a^2+b^2+R^2-2R\sqrt{a^2+b^2}\cos t) dt\\
\end{align}
If $a^2+b^2<R^2$, 
$$ \ln(a^2+b^2+R^2-2R\sqrt{a^2+b^2}\cos t)=2\ln R +\ln(1-2z\cos t +z^2)$$
with $z=\frac{\sqrt{a^2+b^2}}{R}$. We have a decomposition of the second $\ln$ using a generating function for the Chebyshev polynomials:
$$ \ln(1-2z\cos t +z^2)=-2\sum_{n=1}^\infty \frac{\cos nt}{n}z^n$$
Integral over $0,2\pi$ of each term of this series is zero, by symmetry. Thus
$$ I=-2\pi R\ln R$$
If $a^2+b^2>R^2$, calculating along the same lines gives
$$ I=-2\pi R\ln \sqrt{a^2+b^2}$$
</s>