> From: Ian Clark > > Interestingly the alternative implementation (after Ewart Shaw) of the > verb: cnd which is introduced later will work correctly with the > original definition of BlackScholes, not needing the cnd"0 fix. > Because for Shaw's implementation: > > cnd (d1,d2) <--> (cnd d1),(cnd d2) > > This discrepancy is something the owners of statdist.ijs in J602 might > like to ponder.
The line in the article that loads the statdist.ijs script looks like it is missing a tilde. I suspect that it won't work in its current form. Should probably be: load '~system\packages\stats\statdist.ijs' However the scripts in ~system/packages/stats have recently been recreated as the stats/base addon. http://www.jsoftware.com/jwiki/Addons/stats/base As I understand it the plan is for many of the packages currently distributed in ~system/packages to be removed from there and made available as addons instead. For that reason I think it would be safer to reference the script in its new incarnation as: load 'stats/base/distribution' or if you want to make it more obvious that it is an addon & must be installed: load '~addons/stats/base/distribution.ijs' That script also includes the verbs erf and normalcdf which are basically the erf & cnd described in the At Play with J article. http://www.jsoftware.com/jwiki/Addons/stats/base/distribution For a more well-behaved cumulative normal distribution verb, I suggest using the verb pnorm (or pnorm01_pdistrib_) from the stats/distribs addon. http://www.jsoftware.com/jwiki/Addons/stats/distribs pnorm uses Ewart Shaw's algorithm for values between _7 & 7, but a Chebychev expansion for values outside that range where normalcdf becomes unstable as explained on the addon page. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
