DONE somepart of ittttttttttttttt!!!

parent 7100bd90
......@@ -14,40 +14,66 @@
"<h4 style=\"text-align: center;\"> March 28, 2019 </h4>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. A propos du calcul de $\\pi$\n",
"\n",
"### 1.1. En demandant à la lib maths \n",
"Mon ordinateur m'indique que $\\pi$ vaut *approximativement*\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n"
"3.141592653589793\n"
]
}
],
"source": [
"x=1\n",
"print(x)"
"from math import *\n",
"print(pi)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 1.2. En utilisant la méthode des aiguilles de Buffon \n",
"\n",
"Mais calculé avec la **méthode** des [aiguilles de Buffon](http://fr.wikipedia.org/wiki/Aiguille_de_Buffon), on obtiendrait comme **approximation** :\n"
]
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1] 1\n"
]
"data": {
"text/plain": [
"3.128911138923655"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x=1\n",
"print(x)"
"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)\n"
]
},
{
......
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