Double Integral: Monte Carlo Method

12132018, 01:39 PM
Post: #1




Double Integral: Monte Carlo Method
Blog post: https://edspi31415.blogspot.com/2018/12/...ouble.html
About MONTEINT The program MONTEINT calculates the double integral ∫ ∫ f(x,y) dx dy over a circular area with center (X, Y) and radius R. Please be sure the function is continuous and exists over the entire circular region. In order to help with the calculation time is that the program runs the calculations several times and averages the results. You enter the number of batches (B, number of times the calculation is made) and the number of sample points of each batch (N). Code: EXPORT MONTEINT(f,C,D,R,B,N) Note: Enter f(X,Y) in single quotes. Example 1: f(X,Y) = √(LN(X + Y)) over a circle with center (5,5) of radius 1. 20 batches of 50 points each. The value is approximately 4.76. Example 2  A Cautionary Tale: f(X,Y) = X^2 + X*Y + Y^3 over a circle with center (0,0) of radius 2. 20 batches of 50 points each. To illustrate how the Monte Carlo method is at the mercy of random points, the results vary between 11.3 to 13.1. I am going to increase the number of batches to 30 with 100 points each. Thankfully with the HP Prime's processing speed, this won't increase the calculation by a large amount. The TI84 Plus CE will require a longer wait. After five trials, I get values between 12.07 and 13.15. Increasing the number of points per batch to 200, I get results of 11.3 to 12.6. The function f(X,Y) = X^2 + X*Y + Y^3 may not be a good function for the Monte Carlo method. CAUTION: The Monte Carlo is a method to calculate double integrals but it's only for approximate values only. Several evaluations may be necessary to get a satisfactory approximation. Source: Ward Cheney and David Kincaid Numerical Mathematics and Computing Sixth Edition Thomson Brooks/Cole: Belmont, CA 2008 ISBN13 9780495114758 

« Next Oldest  Next Newest »

Messages In This Thread 
Double Integral: Monte Carlo Method  Eddie W. Shore  12132018 01:39 PM

User(s) browsing this thread: 1 Guest(s)