TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Binomial distribution example More...
#include <cmath>
#include <iostream>
Go to the source code of this file.
Functions | |
double | binomial_expected (double n, double p) |
double | binomial_variance (double n, double p) |
double | binomial_standard_deviation (double n, double p) |
double | nCr (double n, double r) |
double | binomial_x_successes (double n, double p, double x) |
double | binomial_range_successes (double n, double p, double lower_bound, double upper_bound) |
int | main () |
Binomial distribution example
The binomial distribution models the number of successes in a sequence of n independent events
Summary of variables used:
Definition in file binomial_dist.cpp.
double binomial_expected | ( | double | n, |
double | p ) |
finds the expected value of a binomial distribution
[in] | n | |
[in] | p |
Definition at line 22 of file binomial_dist.cpp.
double binomial_range_successes | ( | double | n, |
double | p, | ||
double | lower_bound, | ||
double | upper_bound ) |
calculates the probability of a result within a range (inclusive, inclusive)
Definition at line 74 of file binomial_dist.cpp.
double binomial_standard_deviation | ( | double | n, |
double | p ) |
finds the standard deviation of the binomial distribution
[in] | n | |
[in] | p |
Definition at line 36 of file binomial_dist.cpp.
double binomial_variance | ( | double | n, |
double | p ) |
finds the variance of the binomial distribution
[in] | n | |
[in] | p |
Definition at line 29 of file binomial_dist.cpp.
double binomial_x_successes | ( | double | n, |
double | p, | ||
double | x ) |
calculates the probability of exactly x successes
Definition at line 65 of file binomial_dist.cpp.
int main | ( | void | ) |
main function
Definition at line 84 of file binomial_dist.cpp.
double nCr | ( | double | n, |
double | r ) |
Computes n choose r
[in] | n | |
[in] | r |
Definition at line 47 of file binomial_dist.cpp.