matlab - Cumulative Normal Distribution Function in C/C++ with parameters -


i want implement equivalent of matlab normcdf function in c++, have found useful post: cumulative normal distribution function in c/c++ pointing implementation http://www.johndcook.com/cpp_phi.html. want optional mu , sigma parameters in matlab.

is ok, when change this:

x = fabs(x)/sqrt(2.0); 

to:

x = fabs(x - mu)/sqrt(2.0 * sigma * sigma); 

or supposed else?

watch out - want save sign of x-mu, not of x:

int sign = 1; if (x < mu)     sign = -1; x = fabs(x-mu)/sqrt(2.0*sigma*sigma); 

otherwise scaling correct.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -