[Tutor] How to calculate the cumulative normal distribution

Steven D'Aprano steve at pearwood.info
Wed Sep 30 14:36:33 CEST 2015


On Wed, Sep 30, 2015 at 09:12:20AM +0300, Michel Guirguis wrote:
> Good afternoon,
> 
> How to calculate the cumulative normal distribution function CND in 
> order to use this figure to calculate the call option based on the 
> Black and Scholes model.
> 
> >>> from math import*
> >>> def CND(X):
> 	m = abs(X)
> 	[a1,a2,a3,a4,a5]=(0.31938153,-0.356563782,1.781477937,-1.821255978,1.330274429)
> 	k = 1/(1+0.2316419*m)
> 	CND1 = 1.0-1.0/ sqrt(2*3.1415)* exp(-m*m*0.5)
> 	CND2 =(a1*k + a2*k*k+a3*k*k*k+a4*k*k*k*k+a5*k*k*k*k*k)
> 	CND = CND1*CND2

That cannot possibly be the *cumulative* normal distribution, as that 
should approach 1 as x gets really large:

py> CND(2000000.0)
6.893832052455898e-07


Are you sure this is the right description or algorithm?


-- 
Steve


More information about the Tutor mailing list