From 1c7f434925855fb2eede8a9584f111767f71cf7e Mon Sep 17 00:00:00 2001 From: 0f623420645871a6294cae0fa044d4cb <0f623420645871a6294cae0fa044d4cb@app-learninglab.inria.fr> Date: Sat, 5 Sep 2020 11:21:40 +0000 Subject: [PATCH] Fir commit --- module2/exo1/toy_notebook_en.ipynb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/module2/exo1/toy_notebook_en.ipynb b/module2/exo1/toy_notebook_en.ipynb index 78c4ec7..bf7b71a 100644 --- a/module2/exo1/toy_notebook_en.ipynb +++ b/module2/exo1/toy_notebook_en.ipynb @@ -105,6 +105,33 @@ "ax.scatter(x[reject], y[reject], c='r', alpha=0.2, edgecolor=None)\n", "ax.set_aspect('equal')" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "It is then straight forward to obtain a (not really good) approximation to $\\pi$ by counting how many times, on average, $X^2$ + $Y^2$ is smaller than 1:" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "3.112" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "4*np.mean(accept)" + ] } ], "metadata": { -- 2.18.1