The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Monte Carlo Integration
Replies: 1   Last Post: Sep 10, 2012 9:48 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
kumar vishwajeet

Posts: 96
Registered: 4/6/10
Monte Carlo Integration
Posted: Sep 9, 2012 4:00 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I am integrating the following function between L and U using dblquad. I get "NaN" and a warning of singularity.
F = real(constantForM.*((x-L).^(A(1)-1).*(y-L).^(A(2)-1).*(U-L-((x-L)+(y-L))).^(A(3)-1)).^2

where, constantForM = 3.378137617443966e-038.
L = 1e-7
U = 3.2e5
A = [3.75 0.25 0.02]

In order to check for singularity, I generated 1e6 points between L and U and evaluated F at each of the points. I get a sharp peak(singularity) at halfway. But the value at that point is still less than 1. In fact the maximum value of F along these points is 0.00116 and minimum is close to zero. Then why do I get NaN??

Another thing:
I used Monte Carlo Integration using the following method:
1. Evaluated F at all 1e6 points.
2. Found the average of all those values.
3. Multiplied by the volume i.e. (U-L)*(U-L).
4. I get 119 as the answer.

Which of these two methods is correct??


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.