Consider the integral

$$\int_0^{2\pi} \mathrm{d}x \sqrt{(1-a\cos x)^2 + b}$$

with $a,b>0$. I believe I can somehow evaluate this integral by incomplete elliptic integrals. This would be obvious, for example, if $a=1$. But, in the general case, this integral appears rather challenging. Mathematica, and SymPy have not been useful. And the Weierstrass substitution returns polynomials of 4th degree.

  • 1
    $\begingroup$ It all depends what the variable of integration is. If it's $w$, then you are integrating a constant which should be easy. But if it's $x$, then... $\endgroup$ – Bernard Masse Mar 13 at 16:46
  • $\begingroup$ @BernardMassé Sorry about it. Indeed it's $x$. I corrected the typo. $\endgroup$ – maurizio Mar 13 at 16:48
  • $\begingroup$ I guess, you want to have $(1-a)^2+b \geq 0$ as otherwise, you run into the branch cut of the square root. $\endgroup$ – Fabian Mar 14 at 11:23
  • $\begingroup$ @Fabian If that condition holds the problem is trivial. $\endgroup$ – Parcly Taxel Mar 14 at 14:01

Here is a step-by-step solution where each step is not too hard.

Step 1: Instead of doing a Weierstrass substitution, substitute $t=\cos x$ and take factors out to get $$I=2a\int_{-1}^1\frac{\sqrt{(t-1/a)^2+b/a^2}}{\sqrt{1-t^2}}\,dt$$ The roots of the upper quadratic are always complex since $a,b>0$: $c=\frac{1+\sqrt{-b}}a$ and $c^*$. $$I=2a\int_{-1}^1\frac{\sqrt{(t-c)(t-c^*)}}{\sqrt{1-t^2}}\,dt$$ Step 2: Perform a linear fractional transformation that keeps the integrand's poles at $\pm1$ but shifts the zeros at $c$ and $c^*$ to the imaginary axis, so as to leave only even powers of the polynomial under root. This is the most involved part. Define$\newcommand{Re}{\operatorname{Re}}$ $$A=\frac{1+|c|^2+|c^2-1|}{2\Re(c)}>1$$ $$A_1=A^2-2A\Re(c)+|c|^2>0\qquad A_2=A^2|c|^2-2A\Re(c)+1>0\qquad B=\frac{A_2}{A_1}>0$$ The actual substitution is $u=\frac{At+1}{t+A}$. After taking out more factors $$I=2a\sqrt{A_1(A^2-1)}\int_{-1}^1\frac1{(u+A)^2}\sqrt{\frac{u^2+B}{1-u^2}}\,du$$ Define $g=2a\sqrt{A_1(A^2-1)}$ and move on.

Step 3: Multiply top and bottom by $(u-A)^2\sqrt{u^2+B}$ to get $$I=g\int_{-1}^1\frac{(u-A)^2(u^2+B)}{(u^2-A^2)^2}\frac1{\sqrt{(u^2+B)(1-u^2)}}\,du$$ $$=g\left(\int_{-1}^1\frac{(u^2+A^2)(u^2+B)}{(u^2-A^2)^2}\frac1{\sqrt{(u^2+B)(1-u^2)}}\,du-A\int_{-1}^1\frac{(2u)(u^2+B)}{(u^2-A^2)^2}\frac1{\sqrt{(u^2+B)(1-u^2)}}\,du\right)$$ The two integrands are even and odd about zero respectively, so $$I=2g\int_0^1\frac{(u^2+A^2)(u^2+B)}{(u^2-A^2)^2}\frac1{\sqrt{(u^2+B)(1-u^2)}}\,du$$ We perform a partial fraction decomposition of the rational part of the integrand: $$I=2g\int_0^1\left(1-\frac{3A^2+B}{A^2-u^2}+\frac{2A^2(A^2+B)}{(A^2-u^2)^2}\right)\frac1{\sqrt{(u^2+B)(1-u^2)}}\,du$$ Step 4: Finally we use elliptic integrals (all arguments here follow Mathematica/mpmath conventions). Byrd and Friedman 213.11 gives$\newcommand{sn}{\operatorname{sn}}$ $$I=\frac{2g}{\sqrt{1+B}}\left(V_0-\frac{3A^2+B}{A^2-1}V_1+\frac{2A^2(A^2+B)}{(A^2-1)^2}V_2\right)$$ where $$V_k=\int_0^{K(m)}\frac1{(1-n\sn^2u)^k}\,du\qquad m=\frac1{B+1}\qquad n=\frac1{1-A^2}$$ Step 5: B&F 336.00, .01, .02 gives solutions for the $V_k$. $$V_0=K(m)\qquad V_1=\Pi(n,m)$$ $$V_2=\frac{nE(m) + (m-n)K(m) + (2nm+2n-n^2-3m)\Pi(n,m)}{2(n-1)(m-n)}$$ Putting everything together and simplifying a lot we get the final answer. $$I=4a\sqrt{-n(A_1+A_2)}(E(m)-K(m)+(1-n)\Pi(n,m))$$

  • $\begingroup$ Parcly. Thanks. The puzzle was way beyond my reach this time. B&F I suppose is this reference: link.springer.com/book/10.1007/978-3-642-65138-0 . I attempted indeed with the original substitution that you suggested, but I did not contemplate the LFT option. You definitely nailed it. $\endgroup$ – maurizio Mar 14 at 12:24
  • $\begingroup$ I am fine with all the steps, except indeed Step 2. Can you elaborate further on how you came up with this exact choice for the coefficients of the LTF? Substituting $u$ in the last equation before Step 3 provides a rather cumbersome expression in terms of the $A$s which is not intuitive to simplify and show that it matches the original equation at the beginning of Step 2. Would you advise some computer algebra program for the task (or pencil and paper was still the way to go)? Thanks. $\endgroup$ – maurizio Mar 16 at 22:08
  • $\begingroup$ @maurizio There is an additional restriction I imposed on the LFT: it must map the real axis to the real axis. This forces the form $\frac{At+1}{t+A}$ with $A$ real. I used Mathematica (particularly ComplexExpand) to find the correct $A$ that sends the third and fourth roots to the imaginary axis, thus providing even powers, and simplify the results. $\endgroup$ – Parcly Taxel Mar 17 at 2:39
  • $\begingroup$ Thanks. Sorry again to nag you, but could you post it here or append it to your answer. I am not very practical with Mathematica beyond common algebraic manipulations, and I would be eager to see the full procedure. Mostly because, I have another integral that I want to solve, that is similar to the one that I shared here, and I believe I can capitalize from your procedure, to also solve the latter. $\endgroup$ – maurizio Mar 17 at 11:42

If you make the $z=tan(x/2)$ substitution, Mathematica quickly evaluates the indefinite integral, with this horrible expression:

$$\frac{1}{2} z \sqrt{\frac{\left(a \left(z^2-1\right)+z^2+1\right)^2}{\left(z^2+1\right)^2}+b}-\frac{i \left(z^2+1\right) \sqrt{1-\frac{z^2 \left(a-i \sqrt{b}+1\right)}{a+i \sqrt{b}-1}} \sqrt{1-\frac{z^2 \left(a+i \sqrt{b}+1\right)}{a-i \sqrt{b}-1}} \sqrt{\frac{\left(a \left(z^2-1\right)+z^2+1\right)^2}{\left(z^2+1\right)^2}+b} \left(2 \left(-i a \sqrt{b}+a+b+1\right) F\left(i \sinh ^{-1}\left(\sqrt{\frac{a+i \sqrt{b}+1}{-a+i \sqrt{b}+1}} z\right)|\frac{-a^2+2 i \sqrt{b} a+b+1}{-a^2-2 i \sqrt{b} a+b+1}\right)+\left(a^2+2 i a \sqrt{b}-b-1\right) E\left(i \sinh ^{-1}\left(\sqrt{\frac{a+i \sqrt{b}+1}{-a+i \sqrt{b}+1}} z\right)|\frac{-a^2+2 i \sqrt{b} a+b+1}{-a^2-2 i \sqrt{b} a+b+1}\right)-4 a \Pi \left(\frac{-a+i \sqrt{b}+1}{a+i \sqrt{b}+1};i \sinh ^{-1}\left(\sqrt{\frac{a+i \sqrt{b}+1}{-a+i \sqrt{b}+1}} z\right)|\frac{-a^2+2 i \sqrt{b} a+b+1}{-a^2-2 i \sqrt{b} a+b+1}\right)\right)}{2 \sqrt{\frac{a+i \sqrt{b}+1}{-a+i \sqrt{b}+1}} \left(a^2 \left(z^2-1\right)^2+2 a \left(z^4-1\right)+(b+1) \left(z^2+1\right)^2\right)}$$

  • $\begingroup$ I see. Thanks. A rather horrendous result indeed. I must have mistyped then the Weierstrass substitution, as you suggested. Are you able to retrieve a step-by-step solution? Could you post it here in case? $\endgroup$ – maurizio Mar 13 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.