I need to find a function for PHP that will calculate the standard normal cumalative distribution for a given variable. I'm using this information to build a page that will calculate Put and Call option pricing using the Black Scholes Model. Here is a snipet of the code
<?php
$price=$POST['stock'];
$D=$POST['standev'];
$E=$POST['exercise'];
$R=$POST['riskfree'];
$T=$_POST['maturity'];
$d1=(log($price/$E)+($R+pow($D,2)/2)$T)/($DSQRT($T));
$d2=$d1-($DSQRT($T));
// $nd1=normsdist (d1)
// $nd2=normsdist (d2)
Vc=$price$nd1-$Epow(-1$RT)$nd2 //* Vc=Call Option price
From what you see, its a very basic script that will calculate the Call and Put price from a given variable, designated by user.
I just need the formal to calculate the normal distribution. If you know where I can read up on statistical functions of PHP or know the exact function that would be cool--I arealdy looked through the PHP manual, which doesn't even cover this topic. Of course both would be nice.
If anyone wants the full script, the above is just the main backbone, I zipped the form page, including the results page into a small zip archive. I'm also working on cash valuation and stock valuation scripts.
I'd appreciate any help or criticisms.
Thanks