Evaluate Integral $ I:=\int_0^{2\pi} \cos s \,\log (\sqrt{c^2 + a - 2 \cos s}-c) \, \mathrm d s $ for radially magnetized cylinder When trying to evaluate the magnetic scalar potential $\Phi_m$ of a magnetized cylinder (Magnetization $M$ in $x$-direction, height $Z$, Radius $R$, touching the $xy$-plane from below), I was able to solve two of the three integrals in cylinder coordinates, leaving one to give a completely closed form:
$$\Phi_\mathrm m(\rho,\varphi,z) = \frac {M R} {4 \pi} \cos\varphi \left[\int_0^{2\pi} \cos \tilde \varphi \log \left( \sqrt{\zeta^2 + \rho^2 + R^2 - 2\rho R \cos\tilde \varphi}+\zeta  \right)\,\mathrm d \tilde\varphi\right]_{\zeta=z}^{\zeta=z+Z}   $$
Now I'm desprerately trying to solve the remaining integral, which can be written in the form
$$ I:=\int_0^{2\pi} \cos s \,\log (\sqrt{c^2 + a - 2 \cos s}-c) \, \mathrm d s $$
for some numbers $ c:=\zeta /\sqrt{\rho R}\in\mathbb R $ and $ a:=\rho/R+R/\rho > 2 $. Transforming this into a contour integral around the unit circle then reads
$$ I= \oint_{\partial B_1(0)} (1+z^{-2})\log ( \sqrt {c^2 + a - (z+z^{-1})} - c) \, \mathrm d z  ,$$ but the various branch points for the square root and the log exceed my personal skills in arguing correctly about branch cuts and choosing a suitable integration contour.
Maybe someone could tell, if there is any hope that this integral is solvable in closed form, or if one is stuck with numerical evaluations? Solutions involving special functions (elliptic integrals / Bessel functions / etc.) are definitely no problem.
In my further attempts to aviod the difficulties with the complex $ \log $ function, there is yet another form (via substitutions), which might be solved by a suitable contour integration(?):
$$ I = 2 \int_0^2 \frac {\sqrt{1-v^2} \,\mathrm d v}{(\sqrt{c^2+a-2v}-c) \sqrt {c^2+a-2v}}  $$
 A: Thanks to the observation of @jwimberley, I was able to obtain a closed form sulution containing the three kinds of complete elliptic integrals. Contrary to my initial thoughts, contour integration is not needed; only for the last step I consulted a CAS (computer algebra system).
Is jwimberley pointed out in his comment, $\Phi_{\mathrm m}$ may be written as
$$ \Phi_{\mathrm m} = \frac {MR}{4\pi} \left[\int_0^{2\pi} \sigma \cos \tilde \varphi \log \left( \sqrt {\zeta^2 +\rho^2 +R^2-2\rho R\cos(\varphi - \tilde \varphi)}+\sigma\zeta \right)\,\mathrm d \tilde \varphi \right]_{\zeta=z}^{\zeta=z+Z}$$ for all $\sigma \in \{+1,\,-1\} $ (i.e. for both choices, the formula is correct).
By shuffling the $\varphi$-dependence out of the $\log$ and using the trigonometric addition formula, one has $$ \Phi_{\mathrm m} = \frac {MR}{4\pi} \sigma  \left[\int_0^{2\pi} \left(\cos \tilde \varphi \cos\varphi -\sin \tilde \varphi \sin \varphi  \right)  \log \left( \sqrt {\zeta^2 +\rho^2 +R^2-2\rho R\cos\varphi}+\sigma\zeta \right)\,\mathrm d \tilde \varphi \right]_{\zeta=z}^{\zeta=z+Z},$$ where the $\sin \tilde \varphi$ part vanishes in the integral due to anti-symmetry.
Integrating by parts and writing $a:=\rho/R+R/\rho$ and $c:=\zeta/\sqrt{\rho R}$ one gets $$ \Phi_{\mathrm m} = -\frac {MR}{4\pi} \cos\varphi \left[\int_0^{2\pi}\frac\sigma{\sqrt{c^2+a-2\cos\tilde\varphi}+\sigma c}\cdot\frac{\sin^2\tilde\varphi} {\sqrt {c^2+a-2\cos\tilde\varphi}}\,\mathrm d \tilde\varphi\right]_{c=z/\sqrt{\rho R}}^{c=(z+Z)/\sqrt{\rho R}},$$ as before valid for both choices of $\sigma = \pm 1$. Thus, as the crucial step, we can average over the two values of $\sigma$ and obtain
$$ \Phi_{\mathrm m} = \frac {MR}{4\pi} \cos\varphi \left[\int_0^{2\pi}\frac c{a-2\cos\tilde\varphi}\cdot\frac{\sin^2\tilde\varphi} {\sqrt {c^2+a-2\cos\tilde\varphi}}\,\mathrm d \tilde\varphi\right]_{c=z/\sqrt{\rho R}}^{c=(z+Z)/\sqrt{\rho R}}.$$
Now, by taking the integral only over the interval $[0,\,\pi]$ (compensated by an overall factor of $2$), and substituting $w=1-\cos\tilde\varphi$ in first step, and $w=2t^2$ in a second step, one arrives at $$\Phi_{\mathrm m} = \frac {MR}{4\pi} \cos\varphi \left[16c \int_0^1\frac {t^2}{a-2+4t^2}\cdot\frac{\sqrt{1-t^2}} {\sqrt {c^2+a-2+4t^2}}\,\mathrm d t\right]_{c=z/\sqrt{\rho R}}^{c=(z+Z)/\sqrt{\rho R}},$$ for which an CAS gave me the closed form solution $$
\Phi_{\mathrm m} = \frac {MR}{4\pi} \cos\varphi \left[\frac c{\sqrt{c^2+a-2}}\left\{(c^2+2a)\mathrm K(m)-(c^2+a-2)\mathrm E(m) - (a+2)\Pi(n,m)\right\}\right]_{c=z/\sqrt{\rho R}}^{c=(z+Z)/\sqrt{\rho R}},$$ $$\text{where}\quad m=\frac{-4}{c^2+a-2}\quad\text{and}\quad n=\frac{-4}{a-2}\quad\left(\text{and}\;a=\frac \rho R + \frac R \rho \;\text{as before}\right)$$ using the closed elliptic integrals $\mathrm K$, $\mathrm E$, and $\Pi$ with the "$m$" argument convention (not "$k^2$").
I admit that I'm not able to explain or prove the last step (i.e. solving the last integral in terms of elliptic functions), but checking numerically, the solution seems correct. I'd be glad if anyone come up with an explanation (or perhaps even a shorter closed form solution). Still, it is my hope that the stated closed form solution may prove valuable for someone.
