maTH
  • 👋Welcome!
  • 🗿Installation
  • Reference
    • 😱Mathematical operations
      • add
      • pascal
      • factorial
      • factorialL
      • GCD
      • LCM
      • pow
      • permutations
      • combinations
      • combinationsWithRep
      • subtract
      • multiply
      • divide
      • sin
      • cos
      • ln
      • log
      • radToDeg
      • degToRad
      • mod
      • abs
      • floor
      • ceil
      • root
      • exp
      • tan
      • arcsin
      • arccos
      • arctan
      • sinh
      • cosh
      • round
    • 🥶Statistics
      • Binomial
      • Poisson
      • Geometric
      • Pascal
      • Hypergeometric
      • Exponential
      • Uniform
    • 🥵Data structures
      • Stack
      • Queue
      • LinkedList
    • 🤓Algorithms
      • Bubble sort
      • Insertion sort
      • Selection sort
      • Merge sort
      • Quicksort
      • Heap sort
      • Count sort
      • Bucket sort
      • Radix sort
    • 😳Constants
Powered by GitBook
On this page
  • Create a new Exponential distribution
  • Example
  1. Reference
  2. Statistics

Exponential

Represents the time between events in a Poisson process, where events occur continuously and independently at a constant average rate.

Don't get confused with Poisson distribution! One measures how many events happen in a given time frame, and the other measures the time between two independed events.

Create a new Exponential distribution

Exponential X = Exponential(lambda); 

creates a continuous Exponential probability distribution.

Distribution properties:

Property
Type/Return type
Description

lambda (λ)

double

Events occur continuously and independently at a constant average rate.

E()

double

Returns the expected value of average time between two events.

D()

double

Represents variance, that measures the spread of dispersion of the random variable around its expected value E(X).

P(int k)

double

The cumulative distribution function: P(X < k)

In continuous probability distributions, P(X = k) = 0.

Example

//Example: The average number of clients is 15 students per hour. What is the 
//probability that you will have to wait not more than 3 minutes for a client 
//to appear?
double lambda = 0.25; //15 students per hour -> 1 client per 4 minutes. 
Exponential X = Exponential(lambda);
std::cout << X.P(3) << std::endl; //0.527633
Exponential X = Exponential(0.125); 
std::cout << X.P(-1) << std::endl; //Error: Number of events cannot be less than 0.  

Good to know: k cannot be negative.

PreviousHypergeometricNextUniform

Last updated 11 months ago

🥶