TITLE: Improper integral containing $\sqrt{\cos x-\frac1{\sqrt 2}}$ in the denominator
QUESTION [9 upvotes]: How do I find the value of this integral--
$$I=\displaystyle\int_{0}^{\pi/4} \frac{\sec^2 x \ dx}{\sqrt {\cos x-\dfrac{1}{\sqrt 2}}}$$
I came across this integral too in physics.

REPLY [13 votes]: $$I=\frac\pi{\sqrt[4]2}+\sqrt{20-14\sqrt2}\ K\!\left(2\sqrt2-3\right)+\sqrt{2+\sqrt2}\ E\!\left(2\sqrt2-3\right)\\-2\sqrt{2-\sqrt2}\ \Pi\left(\sqrt2-1,\,2\sqrt2-3\right)$$
where $K(m), E(m), \Pi(n,m)$ are the complete elliptic integrals of the first, second and third kind:
$$K(m)={\large\int}_0^{\pi/2}\frac{d\theta}{\sqrt{1-m\sin^2\theta}}$$
$$E(m)={\large\int}_0^{\pi/2}\sqrt{1-m\sin^2\theta}\,d\theta$$
$$\Pi(n,m)={\Large\int}_0^{\pi/2}\frac{d\theta}{\left(1-n\sin^2\theta\right)\sqrt {1-m\sin^2\theta}}$$
Note that this notation uses the parameter $m=k^2$ rather than the modulus $k$, that may differ from a convention used in other places.