It is very convenient to calculate normal distribution integrals in python,c# and other languages.
Referring to C + +, many people will find this language very stupid, if not for the sake of efficiency, very few people will write programs in C + +. In fact, recently found that C + + has many well-packaged libraries, such as matrix Computing has Eigen library.
Today I want to compute a standard normal distribution of integrals in C + +. Looked up a lot of things, including boost and so on.
Finally found that c++11 can be directly computed Erf (x), a little change can be calculated Gaussian function integral. Introduction of ERF in Https://en.wikipedia.org/wiki/Error_function
The specific code is as follows:
Const double m_sqrt1_2 = sqrt (0.5);
Double Normalcfd (Double value)
{
Return 0.5 * ERFC (-value * m_sqrt1_2);
}
Main reference: Https://stackoverflow.com/questions/2328258/cumulative-normal-distribution-function-in-c-c
C + + calculates normal distribution integrals