This program illustrates the example of simulation discussed on pages 13 and 14 of Cooper, Bhat and LeBlanc to find the average value of a certain function.

How many values of x should I choose:

The program will choose this many random values of x between 0 and .9, compute y = x^2/(1-x) for each x, and then find the average value of y.



The cumulative average is:

You may easily repeat the simulation several times for the same or different number of x's. Keep a written record of the cumulative averages produced. Repeated simulation with the same number of x's will produce similar, but different values for the cumulative averages, because the program will randomly choose different values for the x's.