I'm trying to understand how to compute the value of Pi by means of the Monte Carlo simulation. I have a circle inside a square where the sides of the square are tangent to the circle. As data I have the number of random points and the ratio between the lenght of one side of the square and the diameter.
$$\displaystyle \frac{l}{d} = r_{a}$$
According to what I've read I have to count the number of points lying inside the circle and the total of points. The area of a circle is $A_{circle} = \pi r^2$ and the area of a square is $A_{square} = l^2$. To check if a point is inside the circle I have to check $\sqrt{x^2+y^2} <= r$
I don't know how to relate the ratio $r_a$ with the radius so to check if the point is inside or outside the circle. Any suggestion?
UPDATE
This has been a really frustrating stuff and is a really simple example of Monte Carlo approximation.
Assuming $d=1$ then I have that $\displaystyle \frac{l}{d} = l = r_a$ Therefore, to check if a random point is inside the circle I have to check only that
$$\sqrt{x^2 + y^2} ≤ \frac{1}{2}$$
or it has to be related to the ratio $r_a$ ??