Question: Exercise 3: Computing using Monte Carlo Simulation Consider a circle of radius r inscribed inside a square of side 2r. The area of the circle
Exercise 3: Computing using Monte Carlo Simulation Consider a circle of radius r inscribed inside a square of side 2r. The area of the circle is and the area of the square is (2r)2. If we pick a point at random anywhere inside the square, then we can calculate that the probability that the point also falls inside the circle is: Now image an experiment where we choose many different random points inside the square and count the total number of points that fall inside the circle Ninside and the total number that fall outside the circle Noutside. If we take a large number of sample points, we can accurately estimate the probability p as: p = Ninside / (Ninside + Nout side) and from our estimate of p, we can then find an estimate for as being = 4p. This type of randomised algorithm is called the Monte Carlo Method. Although it is not an efficient way to compute , it is generally a very useful method of solving problems in physics, engineering and mathematics which cannot be solved analytically. Task: Implement the random experiment described above, using Java. Use your code to find an estimate for . Investigate how the expected accuracy of the estimate for depends on the number of samples used
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
