tmaterna.com

Monte Carlo tips

1. Exponential

The exponential law is given by

(1)
It will be useful to calculate the probability that x be lower than a given value X:
(2)

To generate a random number according to a given law, it is enough to generate a random number r uniformly distributed beween 0 and 1 and to solve

(3)

for X. In the case of the exponential law, it is particularly easy to solve. Combining (2) and (3) gives

Since r and (1-r) have exactly the same distribution, we can replace (1-r) by r and finally obtain the formula to generate a random number X distributed according to (1):

(4)

We will keep the same notation thoughout the remain of the text: all the represent random numbers following a uniform law on ]0,1].


tmaterna.com is maintained by Thomas Materna
thomas@tmaterna.com