[Numpy-discussion] Using normal()

Zachary Pincus zachary.pincus@yale....
Thu Apr 24 13:12:54 CDT 2008


> It works for me:
>
>>> x = arange(0,10)
>>> scale=1
>>> loc=1
>>> norm = 1 / (scale * sqrt(2 * pi))
>>> y = norm * exp(-power((x - loc), 2) / (2 * scale**2))
>>> y
>
> array([  1.46762663e-01,   3.98942280e-01,   1.46762663e-01,
>         5.39909665e-02,   2.68805194e-03,   1.33830226e-04,
>         9.01740968e-07,   6.07588285e-09,   5.54048800e-12,
>         5.05227108e-15])

I assume you 'from numpy import *'? This is why it works -- because  
that import causes the python built-in exp() to be replaced (in the  
current namespace) by numpy.exp().



More information about the Numpy-discussion mailing list