no commit message

parent ac41f24a
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
"hideCode": true "hideCode": true
}, },
"source": [ "source": [
"## En demandant à la lib maths\n", "# En demandant à la lib maths\n",
"Mon ordinateur m’indique que $\\pi$ vaut *approximativement*" "Mon ordinateur m’indique que $\\pi$ vaut *approximativement*"
] ]
}, },
...@@ -43,6 +43,31 @@ ...@@ -43,6 +43,31 @@
"Mais calculé avec la _méthode_ des [aiguilles de Buffon](https://fr.wikipedia.org/wiki/Aiguille_de_Buffon), on obtiendrait comme _approximation_ :" "Mais calculé avec la _méthode_ des [aiguilles de Buffon](https://fr.wikipedia.org/wiki/Aiguille_de_Buffon), on obtiendrait comme _approximation_ :"
] ]
}, },
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"3.128911138923655"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import numpy as np\n",
"np.random.seed(seed=42)\n",
"N = 10000\n",
"x = np.random.uniform(size=N, low=0, high=1)\n",
"theta = np.random.uniform(size=N, low=0, high=pi/2)\n",
"2/(sum((x+np.sin(theta))>1)/N)"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment