0
$\begingroup$

I have two functions and I want to calculate the overlap coefficients between those two functions. A similar question has been answered for Python and R, however, I couldn't find an answer for Mathematica. Is there an inbuilt function that can do this?

http://www.r-bloggers.com/the-overlap-coefficient/

$\endgroup$
  • $\begingroup$ Would that not be the difference between the integrals of those two functions, calculated on the same interval? Could you show the functions you want to work with? $\endgroup$ – MarcoB Nov 19 '15 at 12:39
6
$\begingroup$

Just going on the figures I see in the linked page, it seems if you are dealing with two continuous distribution functions, defined for all real numbers, then the overlap is just the minimum of the two at all points. If they are allowed to go negative, then a different definition is needed I think.

We'll look at the overlap between two Gaussians

func1[t_] := E^(-(t^2/8))/(2 Sqrt[2 \[Pi]]);
func2[t_] := E^(-2 t^2) Sqrt[2/\[Pi]];
Show[Plot[{func1[t], func2[t]}, {t, -5, 5}], 
 Plot[Min[{func1[t], func2[t]}], {t, -5, 5}, PlotStyle -> None, 
  Filling -> Axis]]

enter image description here

Integrate[
 Min[{func1[t], func2[t]}], {t, -∞, ∞}]
N @ %
(* Erf[Sqrt[(2 Log[2])/15]] + Erfc[4 Sqrt[(2 Log[2])/15]] *)
(* 0.418237 *)

Show[Plot[{func1[t - 1], func2[t]}, {t, -5, 5}], 
 Plot[Min[{func1[t - 1], func2[t]}], {t, -5, 5}, PlotStyle -> None, 
  Filling -> Axis]]

enter image description here

Integrate[
 Min[{func1[t - 1], func2[t]}], {t, -∞, ∞}]
N@ %
(* 1/2 (1 + Erf[1/15 Sqrt[2] (-4 + Sqrt[1 + 15 Log[2]])] + 
   Erf[1/15 Sqrt[2] (4 + Sqrt[1 + 15 Log[2]])] + 
   Erf[1/15 (Sqrt[2] - 4 Sqrt[2 + 30 Log[2]])] + 
   Erfc[1/15 Sqrt[2] (1 + 4 Sqrt[1 + 15 Log[2]])]) *)
(* 0.378459 *)

Of course it's possible I'm jumping the gun here, and don't really understand what you are looking for.

$\endgroup$
  • 2
    $\begingroup$ Yep 6k! Clap, Clap $\endgroup$ – user9660 Nov 19 '15 at 13:28
  • 2
    $\begingroup$ Thank you very much. There has been much procrastination of work that has led to this point :-) $\endgroup$ – Jason B. Nov 19 '15 at 13:30

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.