Closed cypressf closed 10 years ago
I tested my normal function by comparing its output to that of norm.pdf
from scipy.stats import norm import math def normal(x, sigma, mu=0.0): """ See equation at http://en.wikipedia.org/wiki/Normal_distribution """ power = -(x-mu)**2 / (2.0*sigma**2.0) multiple = (1.0 / (sigma * math.sqrt(2.0 * math.pi))) return multiple * math.e**power mu = 0.0 sigma = 0.05 x = 0 norm.pdf(loc=mu, scale=sigma, x=x) 7.9788456080286538 normal(x,sigma,mu=mu) 7.978845608028654
I tested my normal function by comparing its output to that of norm.pdf