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 >>> d1=(math.log(S/K)+(r-q+(sig*sig)*0.5)*T)/(sig*math.sqrt(T)) >>> d1 0.10606601717798211 >>> d2 =d1-sig*math.sqrt(T) >>> d2 -0.03535533905932742 >>> call = 50*exp(-0.02*0.5)*CND(d1)-50*exp(-0.03*0.5)*CND(d2) >>> call Thanks, Michel _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor