# L-13 MCS 260 Wed 26 Sep 2007 : 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)