# [Numpy-discussion] Using normal()

Rich Shepard rshepard@appl-ecosys....
Thu Apr 24 12:38:57 CDT 2008

```On Thu, 24 Apr 2008, Zachary Pincus wrote:

> 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

Zachary,

Thank you. I looked in the printed manual, not the built-in docs.

> 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))

OK. I'll work with this as well as the arange.

Rich

--
Richard B. Shepard, Ph.D.               |  Integrity            Credibility
Applied Ecosystem Services, Inc.        |            Innovation
<http://www.appl-ecosys.com>     Voice: 503-667-4517      Fax: 503-667-8863
```