This problem set focuses on random number generation and Monte Carlo integration.

- Write a function that transforms a uniform deviate into a
Rayleigh distributed deviate described by

Generate a suitable number of deviates and plot a normalized histogram to test your function (plot the expected Rayleigh distribution over your histogram for comparison). - The total mass of an object of density is given by

where represents the volume of the object. Using simple Monte Carlo integration, write a program that computes and its estimated error if , where the volume of the object is defined by , , and . Plot with errorbars as a function of the number of points used in the Monte Carlo integration, for between 10 and , in integer powers of 10.

Massimo Ricotti 2015-10-26