[SciPy-User] calculating intersection points in probability curves

Tim Michelsen timmichelsen@gmx-topmail...
Wed Mar 3 16:13:36 CST 2010


Hello,
my mail seems to have been too theoretical.

Below is some example code.

How can I calculate the intersection point (coordinates) between
'distribution_curve' and 'limit_line'?

Which functions could help me here?

Thanks in advance for any help / pointers.

Best regards,
Timmie

#####  EXAMPLE CODE  #######
#!/usr/bin/env python
import pylab as P
import numpy as np

# first create a single histogram
#
mu, sigma = 200, 25
x = mu + sigma*P.randn(10000)

n, bins = np.histogram(x)

# add a line showing the expected distribution
y = P.normpdf( bins, mu, sigma).cumsum()
y /= y[-1]

# the curve for the plot shwoing the distribution
distribution_curve = P.plot(bins, y, 'k--', linewidth=1.5)
# the limit of which the intersection
# point (x / y) with distribution_curve is desired
limit_line = P.axvline(x.mean())

P.show()



More information about the SciPy-User mailing list