1

Possible Duplicate:
erf(x) and math.h
Best library for statistics in C++?

I am wondering if there is any standard way to implement a cumulative normal distribution function in C++. Or, is there any existing library for that task?

Can anyone recommend a good statistics library for C++, if there is any?

Thanks.

Community
  • 1
  • 1
2607
  • 4,037
  • 13
  • 49
  • 64
  • If you would be more specific about what kind of functionality you expect that library to have we could probably give better recommendations. Boost provides some basic tools, and then there are libraries like gsl or ROOT which go further. But it doesn't end there. – Benjamin Bannier Sep 28 '12 at 17:37

2 Answers2

4

You can do this with the erf function (which is include in the standard math library, source).

CDF = 0.5 + 0.5 * erf(x/(sigma * sqrt(2.0)));

sigma = 1.0 for a normal distribution of course.

CrazyCasta
  • 26,917
  • 4
  • 45
  • 72
1

Boost is as good as the standard. For more boost maths/statistical.

Simple example for stand-alone C++ implementation of the cumulative normal distribution is available Here

nKandel
  • 2,543
  • 1
  • 29
  • 47