exercise:Ba6bca51a5: Difference between revisions

From Stochiki
(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> To simulate the Buffon's needle problem we choose independently the distance <math>d</math> and the angle <math>\theta</math> at random, with <math>0 \leq d \leq 1/2</math> and <math>0 \leq \theta \leq \pi/2</math>, and check whether <math>d \leq...")
 
No edit summary
 
Line 1: Line 1:
<div class="d-none"><math>
To simulate the Buffon's needle problem we choose independently the distance <math>d</math> and the angle <math>\theta</math> at random, with <math>0 \leq d
\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> To simulate the Buffon's needle problem we choose
independently the distance <math>d</math> and the angle <math>\theta</math> at random, with <math>0 \leq d
\leq 1/2</math> and <math>0 \leq \theta \leq \pi/2</math>, and check whether <math>d \leq
\leq 1/2</math> and <math>0 \leq \theta \leq \pi/2</math>, and check whether <math>d \leq
(1/2)\sin\theta</math>.  Doing this a large number of times, we estimate <math>\pi</math> as
(1/2)\sin\theta</math>.  Doing this a large number of times, we estimate <math>\pi</math> as

Latest revision as of 22:25, 12 June 2024

To simulate the Buffon's needle problem we choose independently the distance [math]d[/math] and the angle [math]\theta[/math] at random, with [math]0 \leq d \leq 1/2[/math] and [math]0 \leq \theta \leq \pi/2[/math], and check whether [math]d \leq (1/2)\sin\theta[/math]. Doing this a large number of times, we estimate [math]\pi[/math] as [math]2/a[/math], where [math]a[/math] is the fraction of the times that [math]d \leq (1/2)\sin\theta[/math]. Write a program to estimate [math]\pi[/math] by this method. Run your program several times for each of 100, 1000, and 10,00 experiments. Does the accuracy of the experimental approximation for [math]\pi[/math] improve as the number of experiments increases?