Exercise
A long needle of length [math]L[/math] much bigger than 1 is
dropped on a grid with horizontal and vertical lines one unit apart. We will see (in Exercise \ref{sec 6.3}.) that the average number [math]a[/math] of lines crossed is approximately
To estimate [math]\pi[/math] by simulation, pick an angle [math]\theta[/math] at random between 0 and [math]\pi/2[/math] and compute [math]L\sin\theta + L\cos\theta[/math]. This may be used for the number of lines crossed. Repeat this many times and estimate [math]\pi[/math] by
where [math]a[/math] is the average number of lines crossed per experiment. Write a program to simulate this experiment and run your program for the number of experiments equal to 100, 1000, and 10,00. Compare your results with the methods of Laplace or Buffon for the same number of experiments. (Use [math]L = 100[/math].) \medbreak The following exercises involve experiments in which not all outcomes are equally likely. We shall consider such experiments in detail in the next section, but we invite you to explore a few simple cases here.