> The syntax is normal(loc=0.0, scale=1.0, size=None), but I've not > seen > what those represent, nor how to properly invoke this function. A > clue will > be much appreciated. > > I want to call normal() passing at least the width of the curve(at > the end > points where y=0.0), and the center (where y=1.0). Being able to > specify the > y value of the inflection point (by default 0.5) would also be > helpful.
The 'normal dstribution' is the Gaussian function: N(x) = 1/(std*sqrt(2*pi))*exp(-(x-mean)**2/(2*std**2)), where N(x) is the probability density at position x, given a normal distribution characterized by 'mean' and 'std' (standard deviation). http://en.wikipedia.org/wiki/Normal_distribution Now, numpy.random.normal gives random samples distributed according to the above probability density function. The only remaining mystery is how 'loc' and 'scale' -- the parameters of numpy.random.normal -- map to 'mean' and 'standard deviation', which is how a normal distribution is usually parameterized. Fortunately, the documentation reveals this: >>> print numpy.random.normal.__doc__ Normal distribution (mean=loc, stdev=scale). normal(loc=0.0, scale=1.0, size=None) -> random values If you need an alternate parameterization of the normal (e.g. in terms of the y value of the inflection point), just solve that out analytically from the definition of the normal in terms of mean and std. However, it looks like you're trying to plot the normal function, not get random samples. Just evaluate the function (as above) at the x positions: mean, std = (0, 1) x = numpy.linspace(-10, 10, 200) # 200 evenly-spaced points from -10 to 10 y = 1/(std*numpy.sqrt(2*numpy.pi))*numpy.exp(-(x-mean)**2/(2*std**2)) Zach _______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
