Question: MONTE CARLO APPROXIMATION: Write a function for the algorithm for approximating pi. Characterize the performance of the algorithm by plotting the value and the error
For example, the value of x can be approximated using a Monte Carlo methods Draw a square then inscribe a circle within it. From plane geometry, the ratio of the area of an inscribed circle to that of the surrounding square is /4. Uniformly scatter random numbers throughout the square. Since the two areas are in the ratio /4, the numbers should fall in the areas in approximately the same ratio. Thus, counting the random numbers in the circle and dividing by the random numbers in the square will yield an approximation for /4. Multiplying the result by 4 will then yield an approximation for itself. 1. 1 2. 3. 0 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
