Solving an integral which results in elliptic integrals without never having heard of elliptic integrals Last week I asked this question here and got a very well explained answer. Yet again I might say I am very very rusty on my mathematics, but in this case I've never even heard of elliptic integrals up to the point I saw this paper. In the paper they define:
$$\rho = r_m(\varphi) = \frac{1}{2}\lim_{n\to+\infty}\left(|\cos{\frac{m\varphi}{4}|^n}+|\sin{\frac{m\varphi}{4}}|^n\right)^{-\frac{1}{n}}=\frac{1}{2}\min{\left(\left|\sec{\frac{m\varphi}{4}}\right|,\left|\csc{\frac{m\varphi}{4}}\right|\right)}\label{1}(1)$$
Then they define that the length of the closed curve $C_m$ is given by
$$l_m =  \int_{0}^{2\pi} \sqrt{r_m^2(\varphi)+\left[\frac{dr_m(\varphi)}{d\varphi}\right]^2} \,d\varphi ~(3)$$
The authors say that by using (1) in (3) we can get the following:
$$l_m = \sqrt{8+\frac{m^2}{2}}+4\left[F\left(\frac{\pi}{4}\bigg|1-\frac{m^2}{16}\right)-E\left(\frac{\pi}{4}\bigg|1-\frac{m^2}{16}\right)\right] ~(4)$$
with $F\left(\cdot\bigg|\cdot\right)$ and $E\left(\cdot\bigg|\cdot\right)$ being the elliptic integrals of first and second kind, respectively. I've been able to use this formulation already to get some of the results I want, but I want to understand how the authors got there as it is quite puzzling to me.
Thank you in advance
 A: The curve is composed of $2m$ copies of the patch from $0$ to $\frac\pi m$, over which $r_m(\varphi)=\frac12\sec\frac{m\varphi}4$. Thus, expanding the derivative, we have
$$l_m=2m\int_0^{\pi/m}\sqrt{\frac14\sec^2\frac{m\varphi}4+\frac{m^2}{16}\tan^2\frac{m\varphi}4\sec^2\frac{m\varphi}4}\,d\varphi$$
Substitute $u=\frac{m\varphi}4$ and simplify:
$$=\int_0^{\pi/4}\sqrt{(\sec^2u)(16+m^2\tan^2u)}\,du=4\int_0^{\pi/4}\frac1{\cos^2u}\sqrt{1-\left(1-\frac{m^2}{16}\right)\sin^2u}\,du$$
Define $1-\frac{m^2}{16}=M$ for brevity. We can rewrite the integrand as
$$\frac{\sec^2u-M\tan^2u}{\sqrt{1-M\sin^2u}}=\frac{M-M\sec^2u+\sec^2u}{\sqrt{1-M\sin^2u}}=\frac{1-(1-M\sin^2u)+M\cos^2u-(M-1)\sec^2u}{\sqrt{1-M\sin^2u}}$$
$$=\frac1{\sqrt{1-M\sin^2u}}-\sqrt{1-M\sin^2u}+\frac{M\cos^2u-(M-1)\sec^2u}{\sqrt{1-M\sin^2u}}$$
The first two parts we recognise as the integrands of the $F$ and $E$ elliptic integrals respectively; their parameter is $M$ and the first argument is the upper limit of the last integral we had before we embarked on splitting the integrand, i.e. $\frac\pi4$. The integral of the last part is $(\tan u)\sqrt{1-M\sin^2u}$.
Finally we have
$$l_m=4F(\pi/4|M)-4E(\pi/4|M)+4[(\tan u)\sqrt{1-M\sin^2u}]_0^{\pi/4}=4F(\pi/4|M)-4E(\pi/4|M)+\sqrt{8+\frac{m^2}2}$$
