My computer tells me that $\pi$ is *approximatively*
My computer tells me that $\pi$ is *approximatively*
```{r}
```{r}
...
@@ -17,7 +17,7 @@ pi
...
@@ -17,7 +17,7 @@ pi
```
```
## Buffon's needle
## Buffon's needle
Applying the methond of [Buffon's needle](https://en.wikipedia.org/wiki/Buffon%27s_needle_problem), we get the __approximation__)
Applying the method of [Buffon's needle](https://en.wikipedia.org/wiki/Buffon%27s_needle_problem), we get the __approximation__)
```{r}
```{r}
set.seed(42)
set.seed(42)
...
@@ -27,7 +27,7 @@ theta = pi/2*runif(N)
...
@@ -27,7 +27,7 @@ theta = pi/2*runif(N)
2/(mean(x+sin(theta)>1))
2/(mean(x+sin(theta)>1))
```
```
## Using a surface fraction arugment
## Using a surface fraction argument
A method that is easier to understand and does not make use of the $\sin$ function is based on the fact that if $X\sim U(0,1)$ and $Y\sim U(0,1)$, then $P[X^2+Y^2\leq 1] = \pi/4$ (see ["Monte Carlo method" on Wikipedia](https://en.wikipedia.org/wiki/Monte_Carlo_method)). The following code uses this approach:
A method that is easier to understand and does not make use of the $\sin$ function is based on the fact that if $X\sim U(0,1)$ and $Y\sim U(0,1)$, then $P[X^2+Y^2\leq 1] = \pi/4$ (see ["Monte Carlo method" on Wikipedia](https://en.wikipedia.org/wiki/Monte_Carlo_method)). The following code uses this approach:
<p>My computer tells me that <span class="math inline">\(\pi\)</span> is <em>approximatively</em></p>
<p>My computer tells me that <span class="math inline">\(\pi\)</span> is <em>approximatively</em></p>
<pre class="r"><code>pi</code></pre>
<pre class="r"><code>pi</code></pre>
<pre><code>## [1] 3.141593</code></pre>
<pre><code>## [1] 3.141593</code></pre>
</div>
<div id="buffons-needle" class="section level2">
<div id="buffons-needle" class="section level2">
<h2>Buffon’s needle</h2>
<h2>Buffon’s needle</h2>
<p>Applying the methond of <a href="https://en.wikipedia.org/wiki/Buffon%27s_needle_problem">Buffon’s needle</a>, we get the <strong>approximation</strong>)</p>
<p>Applying the method of <a href="https://en.wikipedia.org/wiki/Buffon%27s_needle_problem">Buffon’s needle</a>, we get the <strong>approximation</strong>)</p>
<p>A method that is easier to understand and does not make use of the <span class="math inline">\(\sin\)</span> function is based on the fact that if <span class="math inline">\(X\sim U(0,1)\)</span> and <span class="math inline">\(Y\sim U(0,1)\)</span>, then <span class="math inline">\(P[X^2+Y^2\leq 1] = \pi/4\)</span> (see <a href="https://en.wikipedia.org/wiki/Monte_Carlo_method">“Monte Carlo method” on Wikipedia</a>). The following code uses this approach:</p>
<p>A method that is easier to understand and does not make use of the <span class="math inline">\(\sin\)</span> function is based on the fact that if <span class="math inline">\(X\sim U(0,1)\)</span> and <span class="math inline">\(Y\sim U(0,1)\)</span>, then <span class="math inline">\(P[X^2+Y^2\leq 1] = \pi/4\)</span> (see <a href="https://en.wikipedia.org/wiki/Monte_Carlo_method">“Monte Carlo method” on Wikipedia</a>). The following code uses this approach:</p>