Day 21, Tuesday, April 17, 2018

Pseudo-random numbers, cont'd

Monte Carlo integration, conclusion

Exercise: Estimate the area of the flower whose boundary has the equation r = (2 + cos7θ) in polar coordinates.

flower_s18.png

(Pick points at random in an enclosing rectangle and count the fraction of points that are inside the flower.)

Random numbers with non-uniform probability distributions

Probability density definition

Sums of independent random numbers

Thought exercise (Quiz): The random numbers generated by our LCG, and by numpy.random.rand(), have a uniform density on [0,1]: p(u) = 1.

If we took sums of pairs of such numbers, what would the probabilty density of those sums be? Without the computer, think about it and sketch what you think the histogram of the sums of pairs will look like.

After that, let's check experimentally.

Sums of larger tuples

Let's make sums of triples, sums of quadruples etc., and see how the PDF changes.

Can we shift and stretch or shrink the sums so that the PDF tends to something as n goes to infinity?

Generating pseudo-random numbers with a desired distribution

Radioactive decay and exponential distribution

Other applications of random numbers

Marriage/job problem