"My computer tells me that π is *approximatively*"
"My computer tells me that π is *approximatively*"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 1,
"execution_count": 1,
"metadata": {},
"metadata": {
"hideCode": false,
"hidePrompt": false
},
"outputs": [
"outputs": [
{
{
"name": "stdout",
"name": "stdout",
...
@@ -36,17 +40,21 @@
...
@@ -36,17 +40,21 @@
},
},
{
{
"cell_type": "markdown",
"cell_type": "markdown",
"metadata": {},
"metadata": {
"hidePrompt": false
},
"source": [
"source": [
"## Buffon's needle\n",
"## Buffon's needle\n",
"\n",
"Applying the method 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**"
]
]
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 2,
"execution_count": 2,
"metadata": {},
"metadata": {
"hideCode": false,
"hidePrompt": false
},
"outputs": [
"outputs": [
{
{
"data": {
"data": {
...
@@ -70,10 +78,11 @@
...
@@ -70,10 +78,11 @@
},
},
{
{
"cell_type": "markdown",
"cell_type": "markdown",
"metadata": {},
"metadata": {
"hideCode": false
},
"source": [
"source": [
"## Using a surface fraction argument\n",
"## Using a surface fraction argument\n",
"\n",
"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:"