(a) Demonstrate the validity of the algorithm given in Sec. 8.4.5 for generating from the geom(p) distribution. (Hint: For a real number x and an integer i, ⌊x⌋ = i if and only if i ≤ x < i + 1.) Also verify (with 1 – U in place of U) that this is the inverse-transform algorithm.
(b) Show that the following algorithm is also valid for generating X ~ geom(p):
1. Let i = 0.
2. Generate U ~ U(0, 1) independent of any previously generated U(0, 1) random variates.
3. If U ≤ p, return X = i. Otherwise, replace i by i + 1 and go back to step 2.
Note that if p is large (close to 1), this algorithm is an attractive alternative to the one given in Sec. 8.4.5, since no logarithms are required and early termination is likely.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.