How to compute CDF probability of normal distribution in C++?

boost, c++, normal-distribution, probability, statistics

Solution

You scale -- any N(m, s) can be turned into N(0,1) by dividing by s and subtracting m. So all you need is a cdf for N(0,1) which is provided by a number of libraries.

Here is a simple R example:

R> pnorm(1.96, 0, 1)          # compute cdf of 1.96 for N(0,1)
[1] 0.975002
R> pnorm(1.96*3 + 2, 2, 3)    # mu + sd*1.96 is really the same for N(mu, sd)
[1] 0.975002
R> 

Problem

Is there any function that allow me to compute the CDF probability of a normal distribution, given a mean and sigma ? i.e. for example P( X < x ) given the normal distribution with $\bar{x}$ and $\sigma$. I think boost have this, but I think that it is just for the standard normal distribution.

Original source