Skip to content

Commit c340e01

Browse files
Update the files
1 parent 7a7c7fd commit c340e01

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

DIRECTORY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@
322322
* [Addition Rule](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/probability/addition_rule.cpp)
323323
* [Bayes Theorem](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/probability/bayes_theorem.cpp)
324324
* [Binomial Dist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/probability/binomial_dist.cpp)
325-
* [Exponential Dist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/probability/exponential_dist.cpp)
326325
* [Geometric Dist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/probability/geometric_dist.cpp)
327326
* [Poisson Dist](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/probability/poisson_dist.cpp)
328327
* [Windowed Median](https://github.com/TheAlgorithms/C-Plus-Plus/blob/HEAD/probability/windowed_median.cpp)

probability/exponential_dist.cpp

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
/**
22
* @file
3-
* @brief [Exponential Distribution] (https://en.wikipedia.org/wiki/Exponential_distribution)
3+
* @brief [Exponential Distribution](https://en.wikipedia.org/wiki/Exponential_distribution)
44
*
55
* The exponential distribution is used to model
66
* events occuring between a Poisson process like radioactive decay.
77
*
8-
* P(x,) = ⋋e^(-⋋x)
8+
* \( P(x, \lambda) = \lambda e^{-\lambda x} \)
99
*
1010
* Summary of variables used:
11-
* : rate parameter
11+
* \lambda : rate parameter
1212
*/
13-
#include<cmath>
14-
#include<cassert>
15-
#include<iostream>
1613

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} \)
2021
*/
2122
double exponential_expected(double lambda){
2223
if (lambda<=0){
@@ -26,9 +27,9 @@ double exponential_expected(double lambda){
2627
return 1/lambda;
2728
}
2829

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} \)
3233
*/
3334
double exponential_var(double lambda){
3435
if (lambda<=0){
@@ -38,9 +39,9 @@ double exponential_var(double lambda){
3839
return 1/pow(lambda,2);
3940
}
4041

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} \)
4445
*/
4546
double exponential_std(double lambda){
4647
if (lambda<=0){
@@ -84,7 +85,11 @@ static void test(){
8485
std::cout<<std::endl;
8586
}
8687

88+
/**
89+
* @brief Main function
90+
* @return 0 on exit
91+
*/
8792
int main(){
88-
test(); //Self-implemented test
93+
test(); // Self test implementation
8994
return 0;
90-
}
95+
}

0 commit comments

Comments
 (0)