 |
QuantShare
2011-07-20 06:49:42
0
|
|
Best Answer
Hi Frank,
In "Tools -> Create Functions", you can add the following function:
#functions#
double NORMDIST(double x, double mean, double stddev, bool IsCumulative )
{
if ( IsCumulative )
{
double k = 2 / Math.Sqrt( 3.14159265 );
double z = ( x - mean ) / ( stddev * Math.Sqrt( 2 ) );
double q = k * ( z - Math.Pow(z, 3) / 3 + Math.Pow(z, 5) / 10 - Math.Pow(z, 7) / 42 + Math.Pow(z, 9) / 216
- Math.Pow(z, 11) / 1320 + Math.Pow(z, 13) / 9360 - Math.Pow(z, 15) / 75600 );
return ( 1 + q ) / 2;
}
else
{
return ( 1 / ( Math.Sqrt( 2 * 3.14159265 ) * stddev ) )
* Math.Exp( -Math.Pow(( x - mean ), 2) / ( 2 * Math.Pow(stddev, 2) ) );
}
}
|
|