Question: The Buffon Needle Experiment. The following experiment was devised by Comte Georges-Louis Leclerc de Buffon (17071788), a French naturalist. A needle of length 1 inch

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.)

2. Mew Figure 9 The Buffon Needle Experiment Figure 10 A Hlt

2. Mew Figure 9 The Buffon Needle Experiment Figure 10 A Hlt In the Buffon Needle Experlment

Step by Step Solution

3.42 Rating (161 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Source Code public class BuffonNeedleExp public static void mainString args double ylow yhigh alpha 0 ratio int hitCount 0 for int i 1 i 2 hitCount ra... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Concepts Late Objects Questions!