Asymptotic expansion of complete elliptic integral of third kind Is there a way to compute the expansion of the complete elliptic integral of third kind
$\Pi(n,k)=\int_0^{\pi/2} \frac{d\varphi}{(1-n\sin^2\varphi)\sqrt{1-k^2\sin^2\varphi}}$
for
$\Pi(1+\epsilon,1-\epsilon)\ , \qquad \epsilon\to 0$,
and if so, what is it? 
 A: Assuming $\epsilon > 0$, I get
\begin{equation}
\Pi (1 + \epsilon, 1- \epsilon ) = - \frac{1}{\epsilon \sqrt{3}} \left( \textrm{arcsinh} ( \tfrac{1}{\sqrt{2}} ) + \frac{i \pi}{2} \right) - \frac{1}{4} \log \epsilon + \frac{1}{36} \left( 6 - 8 \sqrt{3} \: \textrm{arcsinh} ( \tfrac{1}{\sqrt{2}} ) + 27 \log 2 - 4 i \pi \sqrt{3} \right) + O(\epsilon).
\end{equation}
To prove it express the elliptic integral in terms of hypergeometric functions. According to http://functions.wolfram.com/EllipticIntegrals/EllipticPi/introductions/CompleteEllipticIntegrals/05/ one has
\begin{equation}
\Pi (1 + \epsilon, 1- \epsilon ) = \Pi \left(1 + \epsilon | (1- \epsilon)^2 \right) = - \frac{i \pi}{2 \epsilon} \sqrt{\frac{1+\epsilon}{3 - \epsilon}} - \frac{\pi (1- \epsilon)^2}{4} \times \sum_{j=0}^\infty (- \epsilon)^j {}_2 F_1 \left( \frac{3}{2}, \frac{3}{2} + j; 2; (1- \epsilon)^2 \right).
\end{equation}
The Wolfram's definition of elliptic integrals differs from your more standard definition, i.e. $\Pi(n, k) = \Pi(n | k^2)$.
To deal with the hypergeometric terms we can use a linear transformation. Equation 15.3.12 of Abramowitz/Stegun gives us
\begin{equation}
{}_2 F_1 \left( \frac{3}{2}, \frac{3}{2} + j; 2; z \right) = \frac{2 \Gamma(1 + j)}{\sqrt{\pi} \Gamma (\tfrac{3}{2} + j)} (1 - z)^{-1-j} \sum_{n=0}^j \frac{ ( \tfrac{1}{2} - j)_n ( \tfrac{1}{2} )_n}{n! (-j)_n} (1 - z)^n - \frac{(-1)^{1+j}}{\sqrt{\pi} \Gamma( \tfrac{1}{2}-j )} \sum_{n=0}^{\infty} \frac{( \tfrac{3}{2} )_n ( \tfrac{3}{2} + j )_n}{n! (1 +j + n)!} (1-z)^n \left[ \log(1 - z) - \psi(1 + n) - \psi(n + j + 2) + \psi(\tfrac{3}{2} + n) + \psi( \tfrac{3}{2} + n + j) \right].
\end{equation}
Since each hypergeometric function is multiplied by $\epsilon^j$, we only need to extract divergences up to and including order $\epsilon^{-j}$, after the substitution $z = (1 - \epsilon)^2$. The second term contains at most the logarithmic divergence, while only elements with $n=0,1$ matter in the first term. For $j \geq 1$ we find
\begin{equation}
{}_2 F_1 \left( \frac{3}{2}, \frac{3}{2} + j; 2; (1 - \epsilon)^2 \right) = \frac{j!}{2^j \sqrt{\pi} \Gamma (\tfrac{3}{2} + j)} \epsilon^{-j} \left[ \frac{1}{\epsilon} + \frac{j^2 + 3j - 1}{2j} + O(\epsilon) \right], \qquad j = 1,2,3,\ldots
\end{equation}
while for $j = 0$ an additional logarithmic divergence appears,
\begin{equation}
{}_2 F_1 \left( \frac{3}{2}, \frac{3}{2}; 2; (1 - \epsilon)^2 \right) = \frac{2}{\pi \epsilon} + \frac{\log ( \epsilon / 8) + 4}{\pi} + O(\epsilon).
\end{equation}
Now we can resum the expansions of the hypergeometrics, which leads to the final result. You can check it numerically.
A: For so-called weak singularities, this method can be used. For $\epsilon > 0$,
$$\Pi(1 - \epsilon, 1 - \epsilon) =
\int_0^{\pi/2} \frac {d t}
 {(\sin^2 t + \epsilon \cos^2 t)
  (\sin^2 t + \epsilon (2 - \epsilon) \cos^2 t)^{1/2}}.$$
The main contribution comes from the vicinity of $t = 0$. Neglecting terms with higher $t$ and $\epsilon$ orders and extending the integration range to infinity, we get
$$ \Pi(1 - \epsilon, 1 - \epsilon)  \sim
\int_0^\infty \frac {dt} {(t^2 + \epsilon)(t^2 + 2\epsilon)^{1/2}} =
\frac \pi {4\epsilon}.$$
This works because the difference between the two integrals grows only logarithmically in $\epsilon$.
If $\Pi(1 + \epsilon, 1 - \epsilon)$ is defined as
$$\Pi(1 + \epsilon, 1 - \epsilon) = K(1 - \epsilon) -
 \Pi\left( \frac {(1 - \epsilon)^2} {1 + \epsilon}, 1 - \epsilon \right)$$
$-$ note that  the relation should involve $\Pi(k^2/n, k)$, not $\Pi(k/n, k)$ $-$ then, in the same way,
$$\Pi(1 + \epsilon, 1 - \epsilon) \sim
-\Pi(1 - 3\epsilon, 1 - \epsilon) \sim \\
-\int_0^\infty \frac {dt} {(t^2 + 3\epsilon)(t^2 + 2\epsilon)^{1/2}} =
-\frac {\ln (2 + \sqrt 3)} {2 \sqrt 3 \,\epsilon},$$
because $K(1 - \epsilon)$ is also $O(\ln \epsilon)$.
