TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
#include <cmath>
#include <iostream>
Go to the source code of this file.
Functions | |
double | poisson_rate (double events, double timeframe) |
double | poisson_expected (double rate, double time) |
double | fact (double x) |
double | poisson_x_successes (double expected, double x) |
double | poisson_range_successes (double expected, double lower, double upper) |
int | main () |
The Poisson distribution counts how many events occur over a set time interval.
Definition in file poisson_dist.cpp.
double fact | ( | double | x | ) |
Compute factorial of a given number
Definition at line 30 of file poisson_dist.cpp.
int main | ( | void | ) |
main function
Definition at line 65 of file poisson_dist.cpp.
double poisson_expected | ( | double | rate, |
double | time ) |
calculate the expected value over a time e.g rate of 2.5 over 10 mins = 2.5 x 10 = 25
Definition at line 25 of file poisson_dist.cpp.
double poisson_range_successes | ( | double | expected, |
double | lower, | ||
double | upper ) |
probability of a success in range for Poisson dist (inclusive, inclusive)
\[P = \sum_i p(\mu,i)\]
Definition at line 54 of file poisson_dist.cpp.
double poisson_rate | ( | double | events, |
double | timeframe ) |
poisson rate:
calculate the events per unit time
e.g 5 dollars every 2 mins = 5 / 2 = 2.5
Definition at line 17 of file poisson_dist.cpp.
double poisson_x_successes | ( | double | expected, |
double | x ) |
Find the probability of x successes in a Poisson dist.
\[p(\mu,x) = \frac{\mu^x e^{-\mu}}{x!}\]
Definition at line 46 of file poisson_dist.cpp.