exercise:2e06e933e2: Difference between revisions
(Created page with "<div class="d-none"><math> \newcommand{\NA}{{\rm NA}} \newcommand{\mat}[1]{{\bf#1}} \newcommand{\exref}[1]{\ref{##1}} \newcommand{\secstoprocess}{\all} \newcommand{\NA}{{\rm NA}} \newcommand{\mathds}{\mathbb}</math></div> 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> o...") |
No edit summary |
||
Line 1: | Line 1: | ||
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:8582afa4e3|Exercise]]) that the average number <math>a</math> of lines crossed is approximately | |||
dropped on a grid with horizontal and vertical lines one unit apart. We will see | |||
(in | |||
is approximately | |||
<math display="block"> | <math display="block"> | ||
Line 24: | Line 16: | ||
experiments equal to 100, 1000, and 10,00. Compare your results with the | 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>.) | methods of Laplace or Buffon for the same number of experiments. (Use <math>L = 100</math>.) | ||
Latest revision as of 21:28, 12 June 2024
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) 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].)