Question: Zy book 4 . 1 1 . 3 : ( Problem 4 . 2 4 in the 1 0 th edition ) . An interesting
Zy book : Problem in the th edition An interesting way of calculating pi is to use a technique known as Monte Carlo. Write a multithreaded at least threads version of this algorithm that creates a separate thread to generate a number of random points. The thread will count the number of points that occur within the circle and store that result in a global variable. When this thread has exited, the parent thread will calculate and output the estimated value of pi
Suppose you have a circle inscribed within a square, as shown in figure below. Assume that the radius of this circle is
First, generate a series of random points as simple x y coordinates. These points must fall within the Cartesian coordinates that bound the square. Of the total number of random points that are generated, some will occur within the circle.
Next, estimate pi by performing the following calculation:
pi number of points in the circletotal number of points
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
