The Buffon Needle Experiment. The following experiment was devised by Comte Georges-Louis Leclerc de Buffon (17071788), a

Question:

The Buffon Needle Experiment. The following experiment was devised by Comte Georges-Louis Leclerc de Buffon (1707–1788), a French naturalist. A needle of length 1 inch is dropped onto paper that is ruled with lines 2 inches apart. If the needle drops onto a line, we count it as a hit. (See Figure 9.) Buffon discovered that the quotient tries/hits approximates π. For the Buffon needle experiment, you must generate two random numbers: one to describe the starting position and one to describe the angle of the needle with the x-axis. Then you need to test whether the needle touches a grid line. Generate the lower point of the needle. Its x-coordinate is irrelevant, and you may assume its y-coordinate ylow to be any random number between 0 and 2. The angle π between the needle and the x-axis can be any value between 0 degrees and 180 degrees (π radians). The upper end of the needle has y-coordinate
yhigh = ylow + sinα

The needle is a hit if yhigh is at least 2, as shown in Figure 10. Stop after 10,000 tries and print the quotient tries/hits. (This program is not suitable for computing the value of π. You need π in the computation of the angle.)

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: