File indexing completed on 2025-08-03 08:14:07
0001
0002
0003 #include "Poisson.h"
0004
0005 using namespace std;
0006
0007
0008 long double
0009 Poisson::poisson_prob( double mean, int value ){
0010
0011 double prob = exp1( mean, value ) * exp2(mean) / fact(value);
0012 return prob;
0013
0014 }
0015
0016 long double
0017 Poisson::exp1( double mean, int value ){
0018
0019 long double output = pow( mean, value );
0020 return output;
0021
0022 }
0023
0024 long double
0025 Poisson::exp2( double mean ){
0026
0027 long double output = pow( 2.718, -1*mean );
0028 return output;
0029
0030 }
0031
0032 long double
0033 Poisson::fact( int value ){
0034
0035 long double output = 1;
0036
0037 for( int i = 1; i <= value; ++i)
0038 output *= i;
0039
0040 return output;
0041
0042 }