[MATRIX-SIG] Question about Numeric.convolve

Perry Stoll pas@xis.xerox.com
Wed, 11 Feb 1998 12:11:41 PST


>> f(x) with a Gaussian.  
>>     for i in range(len(g)):
>>  g[i] = math.exp(-(math.pow((x[i]-mu)/sigma,2)))

> NumPy can do much better:
>   g = Numeric.exp(((x-mu)/sigma)**2)

but only with the right formula ;)

    g = Numeric.exp( -.5 * ((x-mu)/sigma)**2)

And for a normalized Gaussian, don't forget the scaling term
    1.0/(sigma * Numeric.sqrt(2 * Numeric.pi))

-Perry



_______________
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________