Asymptotic expansion of the complete elliptic integral of the first kind The complete elliptic integral of the first kind is defined as $$K(k) = \int_0^{\pi/2} \frac{d x}{\sqrt{1 - k^2 \sin^2 x}}.$$ I would like to derive (at least the first term of) the asymptotic expansion for $k = 1 -\epsilon$. This is certainly not trivial due to lack of uniform convergence which implies that I can't use the Taylor expansion of the integrand. What is the best way to proceed?
You can employ the substitution $y=1- k^2 \sin^2x$ such that the integral can be written as
$$ K(k) = \int_{1-k^2}^1\!dy\,\frac{1}{2 \sqrt{y(1-y)(y-1 +k^2)}}.$$

Now, we can expand the integrand in $\epsilon = 1-k$ and obtain
$$ K(k) = \int_{1-k^2}^1\!dy\frac{1}{2 y \sqrt{1-y}} + O(1). \tag{1}$$
The estimate of the error term follows from the fact that expanding in $\eta =1-k^2$, we have
$$K(k) = \sum_{n=0}^\infty c_n \eta^n  \int_{\eta}^1\!dy\, y^{-1-n} (1-y)^{-1/2}$$
with $c_n$ some constants. Now, we have for $n&gt;0$ that
$$ \int_{\eta}^1\!dy\, y^{-1-n} (1-y)^{-1/2} = O(\eta^{-n})$$
such that only the $n=0$ term diverges for $\eta \to 0$ (which corresponds to $\epsilon \to 0$).

It thus remains to estimate the first term in (1) for $k \to 1$ which is not that difficult:

In fact due to the $1/y$ behavior close to $y=0$, the integral is logarithmically divergent and we have that 
$$K(k) = \frac12 \left|\log (1-k^2)\right| + O(1) = \frac12 \left|\log \epsilon\right| + O(1).$$
Using two point Taylor expansion around $x=(0 ,\frac{\pi}{2})$ series you could get the expression
$$\frac{\pi ^5 k^4}{2560}-\frac{\pi ^5 k^2}{5760}+\frac{\pi }{4 \sqrt{1-k^2}}+\frac{\pi }{4}$$ This has a better quadratic error than the other series near $k=1$.