A Nasty Elliptic Integral

$\newcommand{\bbx}[1]{\,\bbox[8px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

$\ds{\alpha \in \mathbb{C}\setminus\left(-\infty,0\right].\quad}$ Lets $\ds{\alpha = \verts{\alpha}\exp\pars{\ic\phi}\quad}$ where $\ds{\quad-\pi < \phi < \pi\quad}$ and $\ds{\quad\alpha \not= 0}$.

\begin{align} &\int_{-\infty}^{\infty}{\dd x \over \verts{1 + \alpha x^{2}}} = {2 \over \root{\verts{\alpha}}}\int_{0}^{\infty} {\root{\verts{\alpha}}\dd x \over \verts{\vphantom{\Large A} \verts{\alpha}x^{2} + \verts{\alpha}/\alpha}} \\[5mm] \stackrel{\root{\verts{\alpha}}x\ \mapsto\ x}{=}& {2 \over \root{\verts{\alpha}}}\int_{0}^{\infty} {\dd x \over \verts{\vphantom{\Large A} x^{2} + \bar{\alpha}/\verts{\alpha}}} = {2 \over \root{\verts{\alpha}}}\int_{0}^{\infty} {\dd x \over \verts{\vphantom{\Large A} x^{2} + \expo{-\ic\phi}}} \\[5mm] = &\ {2 \over \root{\verts{\alpha}}}\int_{0}^{\infty} {\dd x \over \root{\pars{x^{2} + \expo{-\ic\phi}}\pars{x^{2} + \expo{\ic\phi}}}} \\[5mm] = &\ {2 \over \root{\verts{\alpha}}}\int_{0}^{\infty} {\dd x \over \root{x^{4} + 2\cos\pars{\phi}x^{2} + 1}} \\[5mm] = &\ {2 \over \root{\verts{\alpha}}}\int_{0}^{\infty} {1 \over \root{x^{2} + 2\cos\pars{\phi} + 1/x^{2}}}\,{\dd x \over x} \\[5mm] = &\ {2 \over \root{\verts{\alpha}}}\int_{0}^{\infty} {1 \over \root{\pars{x - 1/x}^{2} + 2 + 2\cos\pars{\phi}}}\,{\dd x \over x} \\[5mm] = &\ {2 \over \root{\verts{\alpha}}}\int_{0}^{\infty} {1 \over \root{\pars{x - 1/x}^{2} + 4\cos^{2}\pars{\phi/2}}}\,{\dd x \over x} \end{align} With the change of variables $\ds{t = x - {1 \over x}}$ and $\ds{x = {\root{t^{2} + 4} + t \over 2}}$: \begin{align} &\int_{-\infty}^{\infty}{\dd x \over \verts{1 + \alpha x^{2}}} = {2 \over \root{\verts{\alpha}}}\int_{-\infty}^{\infty} {\dd t \over \root{t^{2} + 4\cos^{2}\pars{\phi/2}}\root{t^{2} + 4}} \\[5mm] \stackrel{t\ =\ 2\tan\pars{\theta}}{=}\,\,\,&\ {4 \over \root{\verts{\alpha}}}\int_{0}^{\pi/2} {2\sec^{2}\pars{\theta} \over \root{4\tan^{2}\pars{\theta} + 4\cos^{2}\pars{\phi/2}}\bracks{2\sec\pars{\theta}}}\,\dd\theta \\[5mm] = &\ {2 \over \root{\verts{\alpha}}}\int_{0}^{\pi/2} {\dd\theta \over \root{\sin^{2}\pars{\theta} + \cos^{2}\pars{\phi/2}\cos^{2}\pars{\theta}}} \\[5mm] = &\ {2 \over \root{\verts{\alpha}}}\int_{0}^{\pi/2} {\dd\theta \over \root{\cos^{2}\pars{\phi/2} + \sin^{2}\pars{\phi/2}\sin^{2}\pars{\theta}}} \\[5mm] = &\ \bbx{\ds{{2 \over \root{\verts{\alpha}}} \,\mrm{K}\pars{\sin^{2}\pars{\phi \over 2}}}}\,;\qquad\alpha \not= 0\,,\quad \phi = \,\mrm{arg}\pars{\alpha}\,,\quad \phi \in \pars{-\pi,\pi} \end{align}

$\ds{\mrm{K}}$ is the Complete Elliptic Integral of the First Kind.



Suppose $\alpha\in\mathbb{C}\setminus\left(-\infty,0\right]$, and set $\left|\alpha\right|=:\rho\in\left(0,\infty\right)\land\arg{\left(\alpha\right)}=:\theta\in\left(-\pi,\pi\right)$. Given $x\in\mathbb{R}$, we have the following expression for the modulus of the complex expression $\frac{1}{1+\alpha\,x^{2}}$ as a manifestly real function in all of its parameters:

$$\begin{align} \frac{1}{\left|1+\alpha\,x^{2}\right|} &=\frac{1}{\sqrt{\left(1+\alpha\,x^{2}\right)\left(1+\bar{\alpha}\,x^{2}\right)}}\\ &=\frac{1}{\sqrt{1+\left(\alpha+\bar{\alpha}\right)x^{2}+\alpha\bar{\alpha}\,x^{4}}}\\ &=\frac{1}{\sqrt{1+2\,\Re{\left(\alpha\right)}\,x^{2}+\left|\alpha\right|^{2}x^{4}}}\\ &=\frac{1}{\sqrt{1+2\rho\cos{\left(\theta\right)}\,x^{2}+\rho^{2}x^{4}}}.\\ \end{align}$$

As such, define the real function $J:\left(0,\infty\right)\times\left(-\pi,\pi\right)\rightarrow\mathbb{R}$ via the definite integral

$$J{\left(\rho,\theta\right)}:=\int_{-\infty}^{\infty}\frac{\mathrm{d}x}{\sqrt{1+2\rho\cos{\left(\theta\right)}\,x^{2}+\rho^{2}x^{4}}}.$$

Since $J{\left(\rho,\theta\right)}$ is even in $\theta$, we may go ahead and assume WLOG that $0\le\theta<\pi$. Given real parameters $\left(\rho,\theta\right)\in\left(0,\infty\right)\times\left(0,\pi\right)$, we find

$$\begin{align} J{\left(\rho,\theta\right)} &=\int_{-\infty}^{\infty}\frac{\mathrm{d}x}{\sqrt{1+2\rho\cos{\left(\theta\right)}\,x^{2}+\rho^{2}x^{4}}}\\ &=\int_{-\infty}^{\infty}\frac{\mathrm{d}y}{\sqrt{\rho}\sqrt{1+2y^{2}\cos{\left(\theta\right)}+y^{4}}};~~~\small{\left[\sqrt{\rho}\,x=y\right]}\\ &=\frac{2}{\sqrt{\rho}}\int_{0}^{\infty}\frac{\mathrm{d}y}{\sqrt{1+2y^{2}\cos{\left(\theta\right)}+y^{4}}}\\ &=\frac{2}{\sqrt{\rho}}\int_{0}^{\infty}\frac{\mathrm{d}y}{\sqrt{\left[1-2y\sin{\left(\frac{\theta}{2}\right)}+y^{2}\right]\left[1+2y\sin{\left(\frac{\theta}{2}\right)}+y^{2}\right]}}\\ &=\frac{2}{\sqrt{\rho}}\int_{0}^{\infty}\frac{\mathrm{d}y}{\sqrt{4y^{2}\left[\frac{1+y^{2}}{2y}-\sin{\left(\frac{\theta}{2}\right)}\right]\left[\frac{1+y^{2}}{2y}+\sin{\left(\frac{\theta}{2}\right)}\right]}}\\ &=\frac{2}{\sqrt{\rho}}\int_{-1}^{1}\frac{\mathrm{d}t}{\left(1-t^{2}\right)\sqrt{\left[\frac{1+t^{2}}{1-t^{2}}-\sin{\left(\frac{\theta}{2}\right)}\right]\left[\frac{1+t^{2}}{1-t^{2}}+\sin{\left(\frac{\theta}{2}\right)}\right]}};~~~\small{\left[y=\frac{1-t}{1+t}\right]}\\ &=\frac{4}{\sqrt{\rho}}\int_{0}^{1}\frac{\mathrm{d}t}{\sqrt{\left[1+t^{2}-\left(1-t^{2}\right)\sin{\left(\frac{\theta}{2}\right)}\right]\left[1+t^{2}+\left(1-t^{2}\right)\sin{\left(\frac{\theta}{2}\right)}\right]}}\\ &=\frac{4}{\sqrt{\rho}}\int_{0}^{1}\frac{\mathrm{d}t}{\sqrt{\left[1-\sin{\left(\frac{\theta}{2}\right)}+\left(1+\sin{\left(\frac{\theta}{2}\right)}\right)t^{2}\right]\left[1+\sin{\left(\frac{\theta}{2}\right)}+\left(1-\sin{\left(\frac{\theta}{2}\right)}\right)t^{2}\right]}}\\ &=\small{\frac{4}{\sqrt{\rho}}\int_{0}^{1}\frac{\mathrm{d}t}{\sqrt{\left[2\sin^{2}{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}+2t^{2}\sin^{2}{\left(\frac{\pi}{4}+\frac{\theta}{4}\right)}\right]\left[2\sin^{2}{\left(\frac{\pi}{4}+\frac{\theta}{4}\right)}+2t^{2}\sin^{2}{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}\right]}}}\\ &=\frac{4}{\sqrt{\rho}}\int_{0}^{1}\frac{\mathrm{d}t}{\sqrt{4\sin^{2}{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}\sin^{2}{\left(\frac{\pi}{4}+\frac{\theta}{4}\right)}\left[1+\frac{t^{2}\sin^{2}{\left(\frac{\pi}{4}+\frac{\theta}{4}\right)}}{\sin^{2}{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}}\right]\left[1+\frac{t^{2}\sin^{2}{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}}{\sin^{2}{\left(\frac{\pi}{4}+\frac{\theta}{4}\right)}}\right]}}\\ &=\frac{4}{\sqrt{\rho}}\int_{0}^{1}\frac{\mathrm{d}t}{\sqrt{4\sin^{2}{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}\cos^{2}{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}\left[1+\frac{t^{2}\cos^{2}{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}}{\sin^{2}{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}}\right]\left[1+\frac{t^{2}\sin^{2}{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}}{\cos^{2}{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}}\right]}}\\ &=\frac{4}{\sqrt{\rho}}\int_{0}^{1}\frac{\mathrm{d}t}{\sqrt{\cos^{2}{\left(\frac{\theta}{2}\right)}\left[1+t^{2}\cot^{2}{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}\right]\left[1+t^{2}\tan^{2}{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}\right]}}\\ &=\frac{4}{\sqrt{\rho}}\int_{0}^{\cot{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}}\frac{\sec{\left(\frac{\theta}{2}\right)}\tan{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}}{\sqrt{\left(1+u^{2}\right)\left[1+u^{2}\tan^{4}{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}\right]}}\,\mathrm{d}u;~~~\small{\left[t\cot{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}=u\right]}\\ \end{align}$$

Introducing the auxiliary parameter, $\tan{\left(\frac{\pi}{4}-\frac{\theta}{4}\right)}=:\tau\in\left(0,1\right)$, we obtain the following expression of the elliptic integral $J{\left(\rho,\theta\right)}$ in its Legendre canonical form:

$$\begin{align} J{\left(\rho,\theta\right)} &=\frac{2}{\sqrt{\rho}}\int_{0}^{\tau^{-1}}\frac{\left(1+\tau^{2}\right)}{\sqrt{\left(1+u^{2}\right)\left(1+\tau^{4}u^{2}\right)}}\,\mathrm{d}u\\ &=\frac{2\left(1+\tau^{2}\right)}{\sqrt{\rho}}\int_{0}^{\arctan{\left(\frac{1}{\tau}\right)}}\frac{\sec^{2}{\left(\varphi\right)}}{\sqrt{\left[1+\tan^{2}{\left(\varphi\right)}\right]\left[1+\tau^{4}\tan^{2}{\left(\varphi\right)}\right]}}\,\mathrm{d}\varphi;~~~\small{\left[u=\tan{\left(\varphi\right)}\right]}\\ &=\frac{2\left(1+\tau^{2}\right)}{\sqrt{\rho}}\int_{0}^{\cot^{-1}{\left(\tau\right)}}\frac{\mathrm{d}\varphi}{\sqrt{\cos^{2}{\left(\varphi\right)}+\tau^{4}\sin^{2}{\left(\varphi\right)}}}\\ &=\frac{2\left(1+\tau^{2}\right)}{\sqrt{\rho}}\int_{0}^{\cot^{-1}{\left(\tau\right)}}\frac{\mathrm{d}\varphi}{\sqrt{1-\left(1-\tau^{4}\right)\sin^{2}{\left(\varphi\right)}}}\\ &=F{\left(\cot^{-1}{\left(\tau\right)},\sqrt{1-\tau^{4}}\right)}.\blacksquare\\ \end{align}$$

As of now, I have not made any attempt to verify that the incomplete elliptic integral found in the last line above is ultimately equivalent to the complete elliptic integral produced by Mathematica, in which case we've inadvertently stumbled upon an exotic looking transformation identity that can be used to intimidate calculus students during exams, though not much else. ;)


Note: The definition for the incomplete elliptic integral of the first kind used by Wolfram Alpha and Mathematica differs from mine (which comes from DLMF):

$$F{\left(\theta,\kappa\right)}:=\int_{0}^{\theta}\frac{\mathrm{d}\varphi}{\sqrt{1-\kappa^{2}\sin^{2}{\left(\varphi\right)}}};~~~\small{0\le\theta\le\frac{\pi}{2}\land-1\le\kappa\le1\land\neg\left(\theta=\frac{\pi}{2}\land\kappa^{2}=1\right)}.$$



In this answer I use a variable substitution which I cannot find in the already published answers.

Say that $\alpha \neq 0$ and $\alpha = \varrho e^{i\theta}, \, -\pi <\theta< \pi$. Then $|1+\alpha x^2| = \sqrt{\varrho^2x^4 +2\varrho\cos \theta x^2+1}$ and \begin{gather*} I = \int_{-\infty}^{\infty}\dfrac{dx}{|1+\alpha x^2|} = 2\int_{0}^{\infty}\dfrac{dx}{\sqrt{\varrho^2x^4 +2\varrho\cos \theta x^2+1}} =\dfrac{2}{\sqrt{\varrho}} \int_{0}^{\infty}\dfrac{dx}{\sqrt{x^4 +2\cos \theta x^2+1}} = \\[2ex] \dfrac{4}{\sqrt{\varrho}} \int_{0}^{1}\dfrac{dx}{\sqrt{x^4 +2\cos \theta x^2+1}} = \dfrac{4}{\sqrt{\varrho}} \int_{0}^{1}\dfrac{dx}{\sqrt{x^4+2x^2+1-4x^2\sin^2\frac{\theta}{2}}} = \\[2ex] \dfrac{4}{\sqrt{\varrho}} \int_{0}^{1}\dfrac{dx}{(x^2+1)\sqrt{1-\frac{4x^2}{(x^2+1)^2}\sin^2\frac{\theta}{2}}}.\tag{1} \end{gather*} For $0<x<1$ we put $y = \dfrac{2x}{x^2+1}, 0<y<1$. Then \begin{equation*} y(x^2+1)=2x\tag{2} \end{equation*} and \begin{equation*} x= \dfrac{1-\sqrt{1-y^2}}{y}.\tag {3} \end{equation*} From (2) we get \begin{equation*} (x^2+1)dy + 2xydx=2dx \Leftrightarrow dx= \dfrac{x^2+1}{2(1-xy)}dy = \dfrac{x^2+1}{2\sqrt{1-y^2}}dy \end{equation*} where we have used (3) in the last step. Finally we use that in (1). Thus \begin{equation*} I = \dfrac{2}{\sqrt{\varrho}} \int_{0}^{1}\dfrac{dy}{\sqrt{1-y^2}\sqrt{1-y^2\sin^2\frac{\theta}{2}}} = \dfrac{2}{\sqrt{|\alpha|}}K\left(\sin^2\frac{\theta}{2}\right). \end{equation*}