# L-13 MCS 260 10 Feb 2010 : a function # Evaluate the probability density function # of a normal distribution. def npdf ( x, mu = 0, sigma = 1 ): "normal probability density function" import math f = math.exp(-(x - mu)**2/(2*sigma**2)) f = f/(sigma*math.sqrt(2*math.pi)) return f x = input('give x : ') print 'f(', x , ') = ' , npdf(x) m = input('give mean : ') s = input('give standard deviation : ') print 'for mu = ', m, 'and sigma = ', s print 'f(', x , ') = ' , npdf(mu=m,sigma=s,x=x)