From aed68e6eee9b0968fe1c4ce0914ea0636f36caf3 Mon Sep 17 00:00:00 2001 From: b7525ceabcc90ce5cb1c130a2e0cd03b Date: Wed, 16 Sep 2020 16:45:49 +0000 Subject: [PATCH] =?UTF-8?q?correction=20mais=20toujours=20pas=20le=20bon?= =?UTF-8?q?=20r=C3=A9sultat=20pour=20Buffon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module2/exo1/toy_notebook_fr.ipynb | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/module2/exo1/toy_notebook_fr.ipynb b/module2/exo1/toy_notebook_fr.ipynb index 17b4ebd..27b933e 100644 --- a/module2/exo1/toy_notebook_fr.ipynb +++ b/module2/exo1/toy_notebook_fr.ipynb @@ -4,7 +4,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# A propos de $\\pi$\n", + "# À propos de $\\pi$" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ "## En demandant à la librairie maths\n", "Mon ordinateur m’indique que $\\pi$ vaut approximativement" ] @@ -26,7 +32,7 @@ ], "source": [ "from math import *\n", - "print(pi)\n" + "print(pi)" ] }, { @@ -34,7 +40,7 @@ "metadata": {}, "source": [ "## 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__ :" ] }, { @@ -55,12 +61,11 @@ ], "source": [ "import numpy as np\n", - "from math import *\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" + "2/(sum((x+np.sin(theta))>1)/N)" ] }, { @@ -134,13 +139,6 @@ "source": [ "4*np.mean(accept)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { -- 2.18.1