I need to calculate the area where two functions overlap. I use normal distributions in this particular simplified example, but I need a more general procedure that adapts t
The red area on the plot is the integral of min(f(x), g(x))
, where f
and g
are your two functions, green and blue. To evaluate the integral, you can use any of the integrators from scipy.integrate
(quad
's the default one, I'd say) -- or an MC integrator, of course, but I don't quite see the point of that.
I think another solution would be to multiply the two curves, then take the integral. You may want to do some sort of normalization. The analogy is orbital overlap in chemistry: https://en.wikipedia.org/wiki/Orbital_overlap