2
$\begingroup$

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}]
$\endgroup$
2
  • $\begingroup$ 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]) $\endgroup$ Dec 17 '20 at 14:24
  • $\begingroup$ I confirm that it works numerically. Thanks a lot. $\endgroup$
    – Ben
    Dec 17 '20 at 14:34
2
$\begingroup$

I massaged the answer given by Mariusz in the comments. For future reference, the answer is:

$$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.

Edit: This is also the result for the Chernoff distance between the two Cauchy distributions. This follows from the fact that the KL distance is symmetric in that case.

Edit: Since then, I have found that this result can now be found in a slightly different form here.

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

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.