NB. ************************************************ NB. Normal distribution NB. Original script is written by G. Suzuki math p 81 NB. modifyed by M.Shimura NB. *********************************************** nd=:( % &( %: 2p1))&([: ^ [: - [: -: *:@]) NB. same as ndens ndfs2=: 3 : 0 (-: h * (nd 0) + nd y ) + h * +/ nd ( >: i.249) * h =. | y % 250 ) ndf=: 0.5&+@(**ndfs2) NB. Normal Distribution Function by J.Takeuchi stnormal=:(%:@o.@2:)(%~)^@-@-:@*: NP=:3 : 0 (stnormal y)*y%(-`%`+`%)/,(>:+:k),.(*: y)*>:k=.i.28 ) NQ=:3 : 0 (stnormal y)*%`+/1,,y ,.>:i.28 ) Ndist=:3 : 0 if. 3.3:i do. goto_owari. end. z=.Rndm_Norm MM,0,1 S=.S+(S*(r%100)*(1%12))+S*(Vol%100)*(%:1%12)*z Smax=.S>.Smax NB. print S goto_L1. label_owari. w=.(S-K)*(p=:Smax