From 8ee6442728fc1ff950def4384591e78ec4ea585b Mon Sep 17 00:00:00 2001 From: 9bf3a415ee3c604b2204dd53e4e78a4f <9bf3a415ee3c604b2204dd53e4e78a4f@app-learninglab.inria.fr> Date: Mon, 22 Apr 2024 10:57:16 +0000 Subject: [PATCH] final notebook --- module2/exo1/toy_notebook_fr.ipynb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/module2/exo1/toy_notebook_fr.ipynb b/module2/exo1/toy_notebook_fr.ipynb index a2d81a9..bc3c1fa 100644 --- a/module2/exo1/toy_notebook_fr.ipynb +++ b/module2/exo1/toy_notebook_fr.ipynb @@ -109,6 +109,33 @@ "ax.scatter(x[reject], y[reject], c='r', alpha=0.2, edgecolor=None)\n", "ax.set_aspect('equal')" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Il est alors aisé d'obtenir une approximation (pas terrible) de $\\pi$ en comptant combien de fois, en moyenne, $X^2 + Y^2$ est inférieur à 1 :" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3.112" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "4*np.mean(accept)" + ] } ], "metadata": { -- 2.18.1