# Integral for Bhattacharyya distance between two Cauchy distributions

I need to perform the following integral to calculate the Bhattacharyya distance between two Cauchy distributions:

$$I = \frac{\sqrt{b_+ b_-}}{\pi}\int_{-\infty}^{\infty}dx\,\frac{1}{\sqrt{\left[(x-1)^2+b_+^2\right]\left[(x+1)^2+b_-^2\right]}}$$

Here, $$b_+ >0$$, $$b_->0$$, and $$b_+ \neq b_-$$. The case $$b_+ = b_-$$ is solved here.

I saw on another forum that Maple can apparently express this integral in terms for Elliptic functions. But the user displayed their answer in a form that is completely unreadable. I don't have access to Maple, so I tried reproducing the result with Mathematica 12.1 but it seems incapable to find an answer.

Anyone know how I can help Mathematica do this? The code that is not sufficient is:

int = (Sqrt[bp bm]/Pi) Integrate[1/Sqrt[((x - 1)^2 + bp^2) ((x + 1)^2 + bm^2)], {x, -Infinity, Infinity}, Assumptions -> {bp > 0, bm > 0}]

• With Maple I have: (2 Sqrt[2] Sqrt[bm bp] EllipticK[(2 (bm^4 - 2 bm^2 (-4 + bp^2) + (4 + bp^2)^2))/( bm^4 - 2 bm^2 (-4 + bp^2) + (4 + bp^2)^2 + (4 + bm^2 + bp^2) Sqrt[ bm^4 - 2 bm^2 (-4 + bp^2) + (4 + bp^2)^2])])/(Sqrt[ 4 + bm^2 + bp^2 + Sqrt[ bm^4 - 2 bm^2 (-4 + bp^2) + (4 + bp^2)^2]] \[Pi]) – Mariusz Iwaniuk Dec 17 '20 at 14:24
• I confirm that it works numerically. Thanks a lot. – Ben Dec 17 '20 at 14:34

$$I = \frac{4}{\pi}\sqrt{\frac{b_+ b_-}{A_+}} K\left(\frac{A_-}{A_+}\right).$$

Here, I have introduced:

$$A_\pm = 4 + (b_+ \pm b_-)^2,$$

and $$K$$ is the complete elliptic integral of the first kind as defined by Mathematica's EllipticK[].

Edit: I have incorporated Andrea's further simplifications.

• you could complete simplification with ((4*Sqrt[bm*bp])/(Sqrt[ap]*Pi))*EllipticK[am/ap] – Andreas Dec 17 '20 at 18:15
• I checked it numerically and I don't think it gives the right result? There might be other simplifications though. – Ben Dec 17 '20 at 19:32
• {((4*Sqrt[bp*bm])/(Pi*(Sqrt[ap] - Sqrt[am])))* EllipticK[4/(2 - Sqrt[ap/am] - Sqrt[am/ap])] /. {ap -> 4 + (bp + bm)^2, am -> 4 + (bp - bm)^2}, ((4*Sqrt[bm*bp])/(Sqrt[ap]*Pi))* EllipticK[am/ap] /. {ap -> 4 + (bp + bm)^2, am -> 4 + (bp - bm)^2}} /. {bp -> 0.7, bm -> 0.3} – Andreas Dec 17 '20 at 19:41
• You're correct, it works. I had made a mistake. I will change it. – Ben Dec 17 '20 at 20:11