Integral Evaluation Using the Monte Carlo Method
Consider a selection of four functions: , , , and . The area under these curves over the unit interval is , respectively. The Monte Carlo (MC) method can be used to approximate this integral and can be generalized easily to approximate the integral of any other function. The area is approximately the fraction of points in the light blue shaded area. The expected relative error decreases with the number of points, , as . The theoretical relative error is the straight red line plotted to the right on a log-log scale. The blue dot in the relative error diagram is the percent relative error obtained from the MC method. As expected, this dot lies close to the red line.