def stdnormdist(x): #Cumulative standard normal distribution function #Lifted from https://docs.python.org/3.2/library/math.html return (1.0 + math.erf(x / math.sqrt(2.0))) / 2.0