Mth 4135 homework - use monte carlo simulation using 100000


Homework -

Monte Carlo integration is useful for high-dimensional integrals. Let's perform one:

1304 cos(xy + y4) dx dy

(Well, 2D is higher than 1D.)

1. Use a change of variables to recast this integral as an integral over the unit square. (Easy, but do it carefully.)

2. Use Monte Carlo simulation using 100,000 terms (that is, 100,000 pairs of Uniform (0, 1) samples) to estimate the value of this integral. Have your program calculate a 95% confidence interval as we did in class. Put this code in the file called confidence1.cpp. (Make sure you download Declarations.cpp and Definitions.cpp and keep them in the same folder as your file.)

3. Now, elaborate on the last part. Run the last Monte Carlo simulation 1000 times. Once again, Wolfram Alpha can give us a value for the true value of the integral, accurate to 6 decimal places: -0.152629. Count the number of times that this true value lies within your 95% confidence interval. It should be within approximately 950 of the 1000 confidence intervals that you produce. Put this code in the file called confidence1000.cpp.

4. Finally, one more version of the same problem.

This time, we will only compute a single confidence interval. However, now, don't fix the number of samples that you use.

Instead: set an error bound of 0:001. Have your program run until the error estimate 1.96(Std)^(X)/√n is less than 0.001, where n is the number of terms you've produced at a given time, and (Std)^(X) is the standard deviation of those terms. It should then print out the confidence interval (which should have a total width of about 0.002). Important: only have your program perform the check if 1.96(Std)^(X)/√n < 0.001 once every 100,000 terms! Put this code in the file called fixed error.cpp.

Attachment:- Assignment Files.rar

Request for Solution File

Ask an Expert for Answer!!
Advanced Statistics: Mth 4135 homework - use monte carlo simulation using 100000
Reference No:- TGS02787621

Expected delivery within 24 Hours