2 #include <boost/math/special_functions/binomial.hpp>
3 #include <boost/math/distributions/normal.hpp>
10 this->NumberOfExperiments = 1;
11 this->ProbabilityOfSuccess = 0.5;
17 unsigned int n = this->NumberOfExperiments;
20 std::cerr <<
"ERROR: number of successes cannot be greater than number of experiments" <<std::endl;
24 float p = this->ProbabilityOfSuccess;
31 float normal_mean = n * p;
32 float normal_sd = std::sqrt (n * p * (1 - p));
33 mass = boost::math::pdf (boost::math::normal(normal_mean, normal_sd), k);
38 float C = boost::math::binomial_coefficient<float> (n, k);
39 mass = C * std::pow (p, k) * std::pow(1.0 - p, n - k);
float GetProbabilityMassFunction(unsigned int k) const