Monte Carlo simulations for problem 2 on homework 2