Calculate overlap area of two functions
问题 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 to other functions too. See image below to get an idea of what I mean, where the red area is what I'm after: This is the MWE I have so far: import matplotlib.pyplot as plt import numpy as np from scipy import stats # Generate random data uniformly distributed. a = np.random.normal(1., 0.1, 1000) b = np.random.normal(1., 0.1