diff --git a/module2/exo1/toy_notebook_en.ipynb b/module2/exo1/toy_notebook_en.ipynb index 55b16cdeab05fcbd3a9269cf298dce5e09c19e62..ad7cf5e89beda9b54dbcbb555e4706dba983df57 100644 --- a/module2/exo1/toy_notebook_en.ipynb +++ b/module2/exo1/toy_notebook_en.ipynb @@ -18,7 +18,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# On the computation of $\\pi$" + "# On the computation of $\\pi$" ] }, { @@ -90,7 +90,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -109,12 +109,15 @@ "source": [ "%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", + "\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", @@ -125,9 +128,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "It is then straightforward to obtain a (not really good) approximation to $\\pi$ by counting how\n", - "many times, on average, $$X^2$ + $Y^2$$\n", - "is smaller than 1:" + "It is then straightforward to obtain a (not really good) approximation to $\\pi$ by counting how many times, on average, $$X^2$ + $Y^2$$ is smaller than 1:" ] }, {