Update module2/exo1/toy_notebook_fr.ipynb

parent ff9bc555
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"cell_type": "markdown", "cell_type": "markdown",
"metadata": {}, "metadata": {},
"source": [ "source": [
"# À propos du calcul de π" "# À propos du calcul de $\\pi$"
] ]
}, },
{ {
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
"metadata": {}, "metadata": {},
"source": [ "source": [
"## En demandant à la lib maths\n", "## En demandant à la lib maths\n",
"Mon ordinateur m’indique que π vaut approximativement" "Mon ordinateur m'indique que $\\pi$ vaut *approximativement*"
] ]
}, },
{ {
...@@ -38,21 +38,21 @@ ...@@ -38,21 +38,21 @@
"metadata": {}, "metadata": {},
"source": [ "source": [
"## En utilisant la méthode des aiguilles de Buffon\n", "## En utilisant la méthode des aiguilles de Buffon\n",
"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__ :\n"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 5,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"3.128911138923655" "3.1289111389236548"
] ]
}, },
"execution_count": 2, "execution_count": 5,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 6,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
...@@ -93,15 +93,17 @@ ...@@ -93,15 +93,17 @@
} }
], ],
"source": [ "source": [
"%matplotlib inline\n", "%matplotlib inline \n",
"import matplotlib.pyplot as plt\n", "import matplotlib.pyplot as plt\n",
"\n",
"np.random.seed(seed=42)\n", "np.random.seed(seed=42)\n",
"N = 1000\n", "N = 1000\n",
"x = np.random.uniform(size=N, low=0, high=1)\n", "x = np.random.uniform(size=N, low=0, high=1)\n",
"y = np.random.uniform(size=N, low=0, high=1)\n", "y = np.random.uniform(size=N, low=0, high=1)\n",
"1\n", "\n",
"accept = (x*x+y*y) <= 1\n", "accept = (x*x+y*y) <= 1\n",
"reject = np.logical_not(accept)\n", "reject = np.logical_not(accept)\n",
"\n",
"fig, ax = plt.subplots(1)\n", "fig, ax = plt.subplots(1)\n",
"ax.scatter(x[accept], y[accept], c='b', alpha=0.2, edgecolor=None)\n", "ax.scatter(x[accept], y[accept], c='b', alpha=0.2, edgecolor=None)\n",
"ax.scatter(x[reject], y[reject], c='r', alpha=0.2, edgecolor=None)\n", "ax.scatter(x[reject], y[reject], c='r', alpha=0.2, edgecolor=None)\n",
...@@ -117,16 +119,16 @@ ...@@ -117,16 +119,16 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 7,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"3.112" "3.1120000000000001"
] ]
}, },
"execution_count": 4, "execution_count": 7,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
......
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