From bc434ee253b5589a1fc1d981395cd78ccdbbdb4a Mon Sep 17 00:00:00 2001 From: e357093c53bd5903b5ce129c36733f78 Date: Mon, 8 Jul 2024 21:28:05 +0000 Subject: [PATCH] Update module2/exo1/toy_notebook_fr.ipynb --- module2/exo1/toy_notebook_fr.ipynb | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/module2/exo1/toy_notebook_fr.ipynb b/module2/exo1/toy_notebook_fr.ipynb index d893a3b..c76448d 100644 --- a/module2/exo1/toy_notebook_fr.ipynb +++ b/module2/exo1/toy_notebook_fr.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# À propos du calcul de π" + "# À propos du calcul de $\\pi$" ] }, { @@ -12,7 +12,7 @@ "metadata": {}, "source": [ "## 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 @@ "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__ :\n" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "3.128911138923655" + "3.1289111389236548" ] }, - "execution_count": 2, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -76,7 +76,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -93,15 +93,17 @@ } ], "source": [ - "%matplotlib inline\n", + "%matplotlib inline \n", "import matplotlib.pyplot as plt\n", + "\n", "np.random.seed(seed=42)\n", "N = 1000\n", "x = 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", "reject = np.logical_not(accept)\n", + "\n", "fig, ax = plt.subplots(1)\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", @@ -117,16 +119,16 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "3.112" + "3.1120000000000001" ] }, - "execution_count": 4, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } -- 2.18.1