Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

My textbook says you can take any random (x,y )coordinate between -1 and 1 like (-.3, .5) or (.4, -.7) and determine if the given coordinate falls within the circle if you calculate $\sqrt(x^2+y^2)$ < 1.

The part I don't understand is why are you testing the (x,y) coordinate against 1? What is the rationale behind squaring x and y and seeing if it is less than 1? How do you arrive at 1?

Also do you typically only use -1 and 1 when you're dealing with Monte Carlo integration or can you use -5 and 5 or -10 or 10 or any other numbers?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

The equation $\sqrt{x^2+y^2}<1$ is just the equation of a circle of radius one, and the box between $\pm 1$, is just a convenient bounding box who's area is known. This can be extended arbitrarily, for instance, to calculate the area of between the function $\sin x$ and the $x$ axis between $0$ and $\pi/2$, you can use a Monte Carlo method and generate points with $x \in [0,\pi/2]$ and $y \in [0,1]$.

share|improve this answer
    
so if you used -10 and 10 instead of -1 and 1 the formula would then be $\sqrt{x^2+y^2}$ < 100? Is that correct? –  Jessica M. Jun 24 '13 at 6:21
    
@JessicaM. - If you were trying to find the area of a circle of radius $10$, then yes. –  nbubis Jun 24 '13 at 6:38

To use Monte Carlo to evaluate $I=\int_{[0,1]^n} f(x) dx_1...d x_n$ you take a sequence of independent random variables $x_k$ distributed uniformly on $[0,1]^n$ and compute $I_m = \frac{1}{m} (f(x_1)+\cdots + f(x_m))$. Under appropriate integrability assumptions we have $I_m \to I$ is some prescribed sense.

This is easily extended to deal with integrals of the form $I = \int_{[-M,M]^n} f(x) dx_1...d x_n$, in which case the relevant formula is easily shown to be $I_m = (2M)^n\frac{1}{m} (f(x_1)+\cdots + f(x_m))$, where the $x_k$ are independent random variables distributed uniformly on $[-M,M]^n$.

It is straightforward to generate uniform samples in $[-M,M]^n$.

Now suppose you want to evaluate $I=\int_A f(x) dx_1...d x_n$, where the set $A$ lies in some 'box', that is, $A \subset [-M,M]^n$. Note that $I = \int_{[-M,M]^n} f(x)1_A(x) dx_1...d x_n$, where $1_A$ is the indicator function for the set $A$. So you can use the above technique for integrating over a 'box', and modify the function you are integrating by multiplying by the indicator function of the set $A$.

I am guessing that you are trying to use Monte Carlo to evaluate something like $\int_C f(x) dx dy$, where $C=\{(x,y) | x^2+y^2 < 1 \}$. In this case, we take the box $[-1,1]^2$, generate points $x_k$ randomly in the box, and compute $f(x_k) 1_C (x_k)$, and sum the values appropriately to estimate the integral. The formula for $1_C$ is just $1_C(x) = \begin{cases} 1, & x^2+y^2 < 1 \\ 0, & \text{otherwise} \end{cases}$, which is what gives rise to the '1' above.

Note that you could have generated points in the box $[-10,10]^n$ instead, and applied the appropriate formula, the disadvantage is that it will more samples to get an equivalently accurate result.

share|improve this answer
    
thanks for the very detailed explanation but it's a little over my head. I'm still learning the elementary concepts and I really don't fully understand your answer. –  Jessica M. Jun 25 '13 at 3:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.