<s>[INST] Principal value of complete elliptic integral of third kind Q: How to evaluate the following integral?
$$
PV\int_k^1\frac{dt}{(x^2-t^2)\sqrt{(t^2-k^2)(1-t^2)}}
$$
where $k<x<1$. For the sake of definiteness we may assume $x=0.8, k=0.5$.
Attempt: The substitution $t^2=k^2\cos^2\theta+\sin^2\theta$ can be used to transform the integral into
$$
{1\over x^2-1}\int_0^{\pi\over2}\frac{d\theta}{\left(1-\frac{1-k^2}{1-x^2}\sin^2\theta\right)\sqrt{1-(1-k^2)\sin^2\theta}}
$$
which can be expressed as the complete elliptic integral of third kind
$$
{1\over x^2-1}\Pi\left(\frac{1-k^2}{1-x^2},\sqrt{1-k^2}\right)
$$
if $$\frac{1-k^2}{1-x^2}<1\iff x^2<k^2$$
in which case there would not be any singularity in the denominator. But in our case this is not true and the integrand is singular at
$$\theta=\arcsin\left(\sqrt{\frac{1-x^2}{1-k^2}}\right)$$
Can someone show me the right contour for this integral and the nuances that come with it?
 [/INST] Using the parameter notation,
$$PV \int_k^1
 \frac {dt} {(x^2 - t^2) \sqrt {(t^2 - k^2) (1 - t^2)}} =\\
\frac 1 {1 - x^2} \left( \Pi(1 - x^2, 1 - k^2) - K(1 - k^2) \right), \\
0 < k < x < 1.$$
This is independent of how $K$ and $\Pi$ are extended to arguments outside $(0, 1)$. Can be derived in a similar way to this.
</s>