1
1
/* *
2
2
* @file
3
- * @brief [Exponential Distribution] (https://en.wikipedia.org/wiki/Exponential_distribution)
3
+ * @brief [Exponential Distribution](https://en.wikipedia.org/wiki/Exponential_distribution)
4
4
*
5
5
* The exponential distribution is used to model
6
6
* events occuring between a Poisson process like radioactive decay.
7
7
*
8
- * P(x,⋋ ) = ⋋e^(-⋋x )
8
+ * \( P(x, \lambda ) = \lambda e^{-\lambda x} \ )
9
9
*
10
10
* Summary of variables used:
11
- * ⋋ : rate parameter
11
+ * \lambda : rate parameter
12
12
*/
13
- #include < cmath>
14
- #include < cassert>
15
- #include < iostream>
16
13
17
- /* * Find the expected value of the exponential distribution
18
- * \param [in] lambda
19
- * \returns \f$\mu=1/lambda\f$
14
+ #include < cmath> // For power function
15
+ #include < cassert> // For asserting the test cases
16
+ #include < iostream> // For I/O operation
17
+
18
+ /* *
19
+ * @brief the expected value of the exponential distribution
20
+ * @returns \( \mu = \frac{1}{\lambda} \)
20
21
*/
21
22
double exponential_expected (double lambda){
22
23
if (lambda<=0 ){
@@ -26,9 +27,9 @@ double exponential_expected(double lambda){
26
27
return 1 /lambda;
27
28
}
28
29
29
- /* * Find the variance of the exponential distribution
30
- * \param [in] lambda
31
- * \ returns \f$ \sigma^2=1/( lambda^2)\f$
30
+ /* *
31
+ * @brief the variance of the exponential distribution
32
+ * @ returns \( \sigma^2 = \frac{1}{\ lambda^2} \)
32
33
*/
33
34
double exponential_var (double lambda){
34
35
if (lambda<=0 ){
@@ -38,9 +39,9 @@ double exponential_var(double lambda){
38
39
return 1 /pow (lambda,2 );
39
40
}
40
41
41
- /* * Find the standard deviation of the exponential distribution
42
- * \param [in] lambda
43
- * \ returns \f$ \sigma=1/ lambda\f$
42
+ /* *
43
+ * @brief the standard deviation of the exponential distribution
44
+ * @ returns \( \sigma = \frac{1}{\ lambda} \)
44
45
*/
45
46
double exponential_std (double lambda){
46
47
if (lambda<=0 ){
@@ -84,7 +85,11 @@ static void test(){
84
85
std::cout<<std::endl;
85
86
}
86
87
88
+ /* *
89
+ * @brief Main function
90
+ * @return 0 on exit
91
+ */
87
92
int main (){
88
- test (); // Self-implemented test
93
+ test (); // Self test implementation
89
94
return 0 ;
90
- }
95
+ }
0 commit comments