Simplification of Elliptic integrals

Consider an indefinite "elliptic integral”, $$J_n(r):= \int^r_{r_0}\frac{x^n {\rm d}x}{\sqrt{f(x)}}, \quad f(x):=(x-x_1)(x-x_2)(x-x_3),$$ Here, $$r_0>0, n=1,0,-1$$, and $$x_{1,2,3}$$ are roots of cubic equation $$f(x)=0$$.

I am interested in a case when $$f(x)=0$$ has one real root $$x_1>0$$ and two complex roots $$x_2$$ and $$x_3$$ (since it's cubic equation, they are also complex conjugate, $$x_3=\bar{x_2}$$).

I want to know if $$J_{-1}$$ can be written without imaginary number $$i$$, because this integral appear in a problem of physics, $$J_n$$ should be real function. But, so far, I failed to make it. I write down what I faced:

I have tried an integration by substitution. In the present case, let $$x_2=a+ ib$$ and thus $$x_3=\bar{x_2}=a-ib$$. Then we have $$f(x)=(x-x_1)((x-a)^2+b^2)$$.

Now, transform the variable from $$x$$ to $$y$$ with $$x=x_1+p \tan^2y, \quad p:=\sqrt{(x_1-a)^2+b^2}.$$ After some manipulation, $$J_n$$ reduces to $$\frac{\sqrt{p}}{2}J_n(r)=\int\frac{(x_1+p\tan^2y)^n {\rm d}y}{\sqrt{1-A\sin^2y\cos^2y}},$$ where $$A:=2(p-(x_1-a))/p$$ and $$0 by definition.

For $$n=0$$ and $$+1$$, it is no problem. For $$n=0$$, Mathematica returns $$\frac{\sqrt{p}}{2}J_0(r)=\frac{1}{2}F(2y\mid \frac{A}{4}),$$ where $$F(\phi\mid m)$$ is the elliptic integral of the first kind, EllipticF. For $$n=1$$, Mathematica returns a combination of elliptic integrals and elementary functions (I do not express them here).

Note that there is no imaginary number $$i$$ so far.

For $$n=-1$$, however, integration of $$J_{-1}$$, i.e.,

Integrate[(x_1 + p Tan[y]^2)^-1 (1 - A Sin[y]^2 Cos[y]^2)^(-1/2), y]

returns a messy form with $$i$$:

where $$\Pi(n,\phi\mid m)$$ is the incomplete elliptic integral of the third kind. I found that Plot of $$J_{-1}$$ are indeed real under certain range of $$a, p, A$$. But, I guess there should be a simpler form in $$J_{-1}$$ without $$i$$.

Maybe the above transformation is not good for $$J_{-1}$$? Is there some identities that eliminate $$i$$?

I am not comfortable that in the messy form, $$\sqrt{A-4}$$ appears, although $$0. I am beginner of elliptic integral, any comments are welcome. Thank you.

• You can always try the usual suspects, ie (Full)Simplify, PowerExpand, ComplexExpand etc. but honestly this question seems more suited for a math forum. Commented Jun 21, 2022 at 3:40
• @MarcoB The above messy one is already simplified form. Yes, as you suggest, it seems purely mathematical question. I will also post it on math stack exchange. Thank you. Commented Jun 21, 2022 at 4:58
• "I want to know if ... can be written without imaginary number $i$, because this integral appear in a problem of physics, ... should be real..." - not that there isn't an affirmative answer for your particular problem, but are you aware of casus irreducibilis? Commented Jun 21, 2022 at 7:19
• @J.M. Yes, I know casus irreducibilis in mathematics. So, I know my sentence about "result should be real" is actually not appropriate. But, I am still expecting a possibility that $J_{-1}$ can be written in real functions. Commented Jun 21, 2022 at 7:31

I replaced all cos^2 with 1 - sin^2 to arrive at

Integrate[1/((x1 + (p - x1)*Sin[y]^2)*Sqrt[1 - a*Sin[y]^2 +
a*Sin[y]^4])- Sin[y]^2/((x1 + (p - x1)*Sin[y]^2)*
Sqrt[1 - a*Sin[y]^2 + a*Sin[y]^4]), y]


The first integral calculates without further manipulation, the second with the sin^2 in the nominator is given by

Integrate[(x1 + (p - x1)*Sin[y]^2)/((x1 + (p - x1)*Sin[y]^2)*
Sqrt[1 - a*Sin[y]^2 + a*Sin[y]^4]), y] -
Integrate[x1/((x1 + (p - x1)*Sin[y]^2)*Sqrt[1 -
a*Sin[y]^2 +a*Sin[y]^4]), y] =
Integrate[((p - x1)*Sin[y]^2)/((x1 + (p - x1)*Sin[y]^2)*
Sqrt[1 - a*Sin[y]^2 + a*Sin[y]^4]), y]


where the leftmost integral may be simplified to

Integrate[1/Sqrt[1 - a*Sin[y]^2 + a*Sin[y]^4], y]


Now the rightmost integral gives in! Then apply transformations for negative squared modulus of EllipticPi and EllipticF and negative parameter of the EllipticPi . The completely real result can be seen in the Plot command below, still somewhat messy. Maybe someone is able to simplify the ArcTans further, I wasn' t.

a = 0.7; p = 0.3; x1 = 2.3;
Plot[{NIntegrate[1/(Sqrt[1 - a*Cos[yy]^2*Sin[yy]^2]*
(x1 + p*Tan[yy]^2)), {yy, 0.3, y}],
((a*p - 2*(p - x1))/(4*((p - x1)^2 + a*p*x1)))*
EllipticF[2*y, a/4]+(p/(2*Sqrt[p*x1]*Sqrt[(p-x1)^2+a*p*x1]))*
(ArcTan[(Sqrt[(p - x1)^2 + a*p*x1]*Sin[2*y])/(Sqrt[p*x1]*
Sqrt[4 - a*Sin[2*y]^2])] +
ArcTan[(((p-x1)*Cos[2*y])/(p+x1))*((Sqrt[(p-x1)^2+
a*p*x1]*Sin[2*y])/(Sqrt[p]*Sqrt[x1]*Sqrt[4-a*Sin[2*y]^2]))])+
(((4 - a)*p*(p - x1))/(4*(p + x1)*((p - x1)^2 + a*p*x1)))*
EllipticPi[((p - x1)^2 + a*p*x1)/(p + x1)^2, 2*y, a/4] -
(((a*p - 2*(p - x1))/(4*((p - x1)^2 + a*p*x1)))*
EllipticF[2*yy,a/4] +
(p/(2*Sqrt[p*x1]*Sqrt[(p - x1)^2 + a*p*x1]))*
(ArcTan[(Sqrt[(p - x1)^2 + a*p*x1]*
Sin[2*yy])/(Sqrt[p*x1]*Sqrt[4 - a*Sin[2*yy]^2])] +
ArcTan[(((p - x1)*Cos[2*yy])/(p+x1))*
((Sqrt[(p - x1)^2 + a*p*x1]*Sin[2*yy])/
(Sqrt[p]*Sqrt[x1]*Sqrt[4 - a*Sin[2*yy]^2]))]) + (((4 - a)*
p*(p - x1))/(4*(p + x1)*((p - x1)^2 + a*p*x1)))*
EllipticPi[((p - x1)^2 + a*p*x1)/(p + x1)^2, 2*yy, a/4] /.
yy -> 0.3)}, {y, 0.3, Pi/2}, PlotStyle -> {Blue, Dashed}]


Edit: Using Rubi and letting the parameter of EllipticPi staying negative the result of the integral is simpler:

(Sqrt[p]/(2*Sqrt[x1]*Sqrt[(p - x1)^2 + a*p*x1]))*
ArcTan[(Sqrt[p^2-(2-a)*p*x1+x1^2]*Sin[2*y])/(Sqrt[p]*Sqrt[x1]*
Sqrt[4-a*Sin[2*y]^2])]-
(1/(2*(p-x1)))*(EllipticF[2*y,a/4]-((p+x1)/(2*x1))*
EllipticPi[-((p-x1)^2/(4*p*x1)),2*y,a/4])

• Wow! This is really a nice expression. I didn't expect the integral can be reduced to such a compact form. Is it also possible to reduce $J_{-1}$ to your last expression by Mathematica? Sorry, I am not familiar with Rubi. Anyway, your reply is helping me a lot. Commented Jun 22, 2022 at 7:56