std::invalid_argument(
"lambda must be greater than 0");
50 throwstd::invalid_argument(
"lambda must be greater than 0");
52 return1 / pow(lambda, 2);
61 throwstd::invalid_argument(
"lambda must be greater than 0");
74 doubleexpected_1 = 1;
79 doubleexpected_2 = 0.5;
84 doubleexpected_3 = 0.333333;
85 doublevar_3 = 0.111111;
86 doublestd_3 = 0.333333;
89 doublelambda_5 = -2.3;
91 const floatthreshold = 1e-3f;
93std::cout <<
"Test for lambda = 1 \n";
96lambda_1)) < threshold);
98lambda_1)) < threshold);
100lambda_1)) < threshold);
101std::cout <<
"ALL TEST PASSED\n\n";
103std::cout <<
"Test for lambda = 2 \n";
106lambda_2)) < threshold);
108lambda_2)) < threshold);
110lambda_2)) < threshold);
111std::cout <<
"ALL TEST PASSED\n\n";
113std::cout <<
"Test for lambda = 3 \n";
116lambda_3)) < threshold);
118lambda_3)) < threshold);
120lambda_3)) < threshold);
121std::cout <<
"ALL TEST PASSED\n\n";
123std::cout <<
"Test for lambda = 0 \n";
128}
catch(std::invalid_argument& err) {
129assert(std::string(err.what()) ==
"lambda must be greater than 0");
131std::cout <<
"ALL TEST PASSED\n\n";
133std::cout <<
"Test for lambda = -2.3 \n";
138}
catch(std::invalid_argument& err) {
139assert(std::string(err.what()) ==
"lambda must be greater than 0");
141std::cout <<
"ALL TEST PASSED\n\n";
double exponential_expected(double lambda)
the expected value of the exponential distribution
static void test()
Self-test implementations.
double exponential_std(double lambda)
the standard deviation of the exponential distribution
int main()
Main function.
double exponential_var(double lambda)
the variance of the exponential distribution
Functions for the Geometric Distribution algorithm implementation.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4