Calculate overlap area of two functions

后端 未结 2 1704
终归单人心
终归单人心 2020-12-16 04:59

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

相关标签:
2条回答
  • 2020-12-16 05:39

    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.

    0 讨论(0)
  • 2020-12-16 05:52

    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

    0 讨论(0)
提交回复
热议问题