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

Click For Summary

Homework Help Overview

The discussion revolves around estimating the value of pi using a Monte Carlo method, specifically through the formulation of a double integral. Participants explore how to express the Monte Carlo approach in terms of expected values and integrals, questioning the relationship between the area of the unit circle and the integral formulation.

Discussion Character

  • Exploratory, Conceptual clarification, Mathematical reasoning, Assumption checking

Approaches and Questions Raised

  • Participants discuss the original poster's approach of using random pairs to estimate pi and the requirement to express this as a double integral. Some question the necessity of avoiding the trivial method, while others suggest that the integral formulation is indeed relevant to the problem.

Discussion Status

The discussion is ongoing, with participants providing insights into the relationship between the expected value and the double integral. Some have offered guidance on how to frame the problem, while others are exploring different interpretations of the requirements.

Contextual Notes

There is a noted constraint regarding the expectation to use a double integral rather than a straightforward Monte Carlo method, which has led to confusion among participants. The original poster expresses uncertainty about how to proceed with the integral formulation.

Sonden
Messages
7
Reaction score
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,
\int_0^1 \int_0^{2 \pi}rdrd\theta=\pi
but is this useful here?
 
Physics news on Phys.org
This seems dumb, since the upper bound of the integral w.r.t. \theta contains the mathematical constant you are trying to evaluate. I think your initial approach is correct.
 
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?
 
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,
\int_0^1 \int_0^{2 \pi}rdrd\theta=\pi
but is this useful here?
Useful? If that weren't true this method of approximating \pi wouldn't work!

The whole point is that since that integral is equal to \pi, approximating that integral, with a Monte Carlo method, approximates \pi.
 
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

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

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

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

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

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

so

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

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:
You do realize, I hope, that you essentially just rederived the "trivial" method you alluded to in your first post.
 
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... ;)
 
If you denote:

<br /> I(A) = \left\{\begin{array}{ll}<br /> 1&amp;, A \, \mathrm{occurs} \\<br /> <br /> 0 &amp;, \bar{A} \, \mathrm{occurs}<br /> \end{array}\right.<br />

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

<br /> E(I) = 1 \cdot p + 0 \cdot q = p<br />

and

<br /> \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}<br />

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:

Similar threads

Replies
1
Views
1K
Replies
4
Views
2K
Replies
2
Views
2K
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K