Simulating the Poisson process

Simulating poisson

A simulation of the Poisson process, built using Processing.

TheĀ  process models random events occuring in continuous time given that:

  1. Events occur on their own
  2. The average rate of events happening remains constant
  3. Future events have nothing to do with ones which have happened

A process has average rate such as \lambda = \frac{1}{4} per minute. Number of events in t minutes is the discrete random variable X, where X \sim Poisson(\lambda t). The time you have to wait between events follows an exponential distribution T \sim M(lambda).

The simulation works by obtaining a waiting time between each event, through making independent observations on the random variable T \sim M(\lambda). We can do this by solving:

F(t) = u

where u is a random observation on the uniform distribution U(0,1). With the exponention distribution this means solving

1-e^{-\lambda t}=u

which ends up with

t=-\frac{1}{\lambda} log(1-u)

Each time an event is fired, t is recalculated.

One Response to “Simulating the Poisson process”

  1. [...] There are two random processes here: arrivals, and serving time, which in this case are both Poisson processes. There can be one or more servers. A handy notation for this is: M/M/n, where the first M describes [...]

Leave a Reply