A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/d9/da2/exponential__dist_8cpp_source.html below:

TheAlgorithms/C++: probability/exponential_dist.cpp Source File

Go to the documentation of this file. 39 throw

std::invalid_argument(

"lambda must be greater than 0"

);

50 throw

std::invalid_argument(

"lambda must be greater than 0"

);

52 return

1 / pow(lambda, 2);

61 throw

std::invalid_argument(

"lambda must be greater than 0"

);

74 double

expected_1 = 1;

79 double

expected_2 = 0.5;

84 double

expected_3 = 0.333333;

85 double

var_3 = 0.111111;

86 double

std_3 = 0.333333;

89 double

lambda_5 = -2.3;

91 const float

threshold = 1e-3f;

93

std::cout <<

"Test for lambda = 1 \n"

;

96

lambda_1)) < threshold);

98

lambda_1)) < threshold);

100

lambda_1)) < threshold);

101

std::cout <<

"ALL TEST PASSED\n\n"

;

103

std::cout <<

"Test for lambda = 2 \n"

;

106

lambda_2)) < threshold);

108

lambda_2)) < threshold);

110

lambda_2)) < threshold);

111

std::cout <<

"ALL TEST PASSED\n\n"

;

113

std::cout <<

"Test for lambda = 3 \n"

;

116

lambda_3)) < threshold);

118

lambda_3)) < threshold);

120

lambda_3)) < threshold);

121

std::cout <<

"ALL TEST PASSED\n\n"

;

123

std::cout <<

"Test for lambda = 0 \n"

;

128

}

catch

(std::invalid_argument& err) {

129

assert(std::string(err.what()) ==

"lambda must be greater than 0"

);

131

std::cout <<

"ALL TEST PASSED\n\n"

;

133

std::cout <<

"Test for lambda = -2.3 \n"

;

138

}

catch

(std::invalid_argument& err) {

139

assert(std::string(err.what()) ==

"lambda must be greater than 0"

);

141

std::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