How can a double integral be used to estimate pi using Monte Carlo integration?

In summary, according to this student, the double integral that is supposed to be used to calculate pi is not useful, as the upper bound of the integral contains the mathematical constant that is being evaluated. The method that is intended in the problem is essentially evaluating a double integral.
  • #1
Sonden
7
0

Homework Statement


I am supposed to calculate/estimate pi using a Monte Carlo method. This is of course trivial: create N uniformly distributed random pairs (x,y) in [0,1]^2 and check how many, M, that have x^2+y^2<1. Then M/N=pi/4.

Now, the strange thing is that I am not supposed to do it that way. Instead I'm supposed to use a double integral (Monte Carlo integration): "At a first glance, this may not seem like a integration problem, but it can be formulated as such. Write down the (double) integral (and thus the expected value) that correspond to this procedure, i.e. the integral I = 4E[g(X)] = pi", where E[g(X)] is the expected value for a function g and X a random variable. I've glanced at it for several hours now, I still haven't got a clue how to do it. Of course,
[tex]\int_0^1 \int_0^{2 \pi}rdrd\theta=\pi[/tex]
but is this useful here?
 
Physics news on Phys.org
  • #2
This seems dumb, since the upper bound of the integral w.r.t. [itex]\theta[/itex] contains the mathematical constant you are trying to evaluate. I think your initial approach is correct.
 
  • #3
I think your original idea, the one you ruled out, is the method intended in the problem. It is essentially evaluating a double integral. Why do you think you're not supposed to do it that way?
 
  • #4
Sonden said:

Homework Statement


I am supposed to calculate/estimate pi using a Monte Carlo method. This is of course trivial: create N uniformly distributed random pairs (x,y) in [0,1]^2 and check how many, M, that have x^2+y^2<1. Then M/N=pi/4.

Now, the strange thing is that I am not supposed to do it that way. Instead I'm supposed to use a double integral (Monte Carlo integration): "At a first glance, this may not seem like a integration problem, but it can be formulated as such. Write down the (double) integral (and thus the expected value) that correspond to this procedure, i.e. the integral I = 4E[g(X)] = pi", where E[g(X)] is the expected value for a function g and X a random variable. I've glanced at it for several hours now, I still haven't got a clue how to do it. Of course,
[tex]\int_0^1 \int_0^{2 \pi}rdrd\theta=\pi[/tex]
but is this useful here?
Useful? If that weren't true this method of approximating [itex]\pi[/itex] wouldn't work!

The whole point is that since that integral is equal to [itex]\pi[/itex], approximating that integral, with a Monte Carlo method, approximates [itex]\pi[/itex].
 
  • #5
vela: because the teacher wants MC *integration* (that the unit circle's area is pi perhaps follows from integration but...). :)

Is this true?:

4 times the expected value for a function g(X,Y), where X, Y are random variables with some probability distribution f(x,y), is

[tex]4E[g(X,Y)]=4\int\int_{\mathbb{R}^2}g(x,y)f(x,y)dxdy[/tex]

Then if f(x,y)=1/4 in [-1,1]^2 and 0 elsewhere,

[tex]4\int\int_{\mathbb{R}^2}g(x,y)f(x,y)dxdy=\int\int_{[-1,1]^2}g(x,y)dxdy[/tex].

Now if g(x,y)=1 inside the unit circle and 0 elsewhere, we get

[tex]4E[g(X,Y)]=\int\int_{unit \; circle}dxdy=\pi[/tex]

so

[tex]\pi/4=E[g(X,Y)] \approx 1/N\sum_{i=1}^N g(x_i,y_i)[/tex]

according to the law of large numbers (I think?), where (x_i, y_i) are random pairs with f:s distribution, ie they are uniformly distributed on [-1,1]^2 and g(x_i,y_i)=1 if they are inside the unit circle, ie if x_i^2+y_i^2<1, and g(x_i,y_i)=0 otherwise (that is, between the unit circle and [-1,1]^2). Is this derivation correct?
 
Last edited:
  • #6
You do realize, I hope, that you essentially just rederived the "trivial" method you alluded to in your first post.
 
  • #7
But this time I used the law of large numbers, so I know that I can get as close to pi as I wish by taking N large enough. Which was obvious from the start, but still... ;)
 
  • #8
If you denote:

[tex]
I(A) = \left\{\begin{array}{ll}
1&, A \, \mathrm{occurs} \\

0 &, \bar{A} \, \mathrm{occurs}
\end{array}\right.
[/tex]

the indicator of a random event A ([itex]P(A) = p, P(\bar{A}) = q, \, p + q = 1[/itex]), then:

[tex]
E(I) = 1 \cdot p + 0 \cdot q = p
[/tex]

and

[tex]
\sigma^{2}(I) = (1 - p)^2 \cdot p + (0 - p)^2 \cdot q = p q^{2} + p^{2} q = p q (p + q) = p q = p(1 - p) \le \frac{1}{4}
[/tex]

Thus, this random variable satisfies the provisions of the Law of Large numbers and the sample mean is a good estimate of the probability of the event.
 
Last edited:

FAQ: How can a double integral be used to estimate pi using Monte Carlo integration?

What is Monte Carlo integration?

Monte Carlo integration is a numerical method used to estimate the value of a definite integral. It uses random sampling and probability to approximate the area under a curve.

How does Monte Carlo integration work?

To use Monte Carlo integration, a large number of random points are generated within the bounds of the integral. These points are then used to estimate the area under the curve, with the accuracy improving as more points are used.

What are the advantages of using Monte Carlo integration?

Monte Carlo integration can handle integrals with complex or multi-dimensional boundaries, making it a versatile method. It is also less computationally intensive compared to other numerical integration techniques, such as the trapezoidal rule or Simpson's rule.

What are the limitations of Monte Carlo integration?

Monte Carlo integration relies on random sampling, so its accuracy can be affected by the quality of the generated points. It also requires a large number of points to achieve a high level of accuracy, making it more time-consuming for certain problems.

In what applications is Monte Carlo integration commonly used?

Monte Carlo integration is often used in finance, physics, and engineering to simulate complex systems and calculate probabilities. It is also commonly used in machine learning and statistics for estimating integrals in high-dimensional spaces.

Back
Top