From 147ab035ad06016cd76cdd6e37cbb08a846aa6ac Mon Sep 17 00:00:00 2001 From: 2207ee6c4b0763c29ab8f98156e3343c <2207ee6c4b0763c29ab8f98156e3343c@app-learninglab.inria.fr> Date: Thu, 15 Jul 2021 20:03:52 +0000 Subject: [PATCH] aaa --- module2/exo1/toy_notebook_fr.ipynb | 43 +++++++++++++++++------------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/module2/exo1/toy_notebook_fr.ipynb b/module2/exo1/toy_notebook_fr.ipynb index 54c5d55..43e6185 100644 --- a/module2/exo1/toy_notebook_fr.ipynb +++ b/module2/exo1/toy_notebook_fr.ipynb @@ -17,7 +17,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 1, "metadata": { "scrolled": true }, @@ -40,12 +40,12 @@ "metadata": {}, "source": [ "## En utilisant la méthode des aiguilles de Buffon\n", - "Mais calculé avec la __méthode__ des [des aiguilles de Buffon](https://fr.wikipedia.org/wiki/Aiguille_de_Buffon), on obtientdrait comme __approximation__ : " + "Mais calculé avec la __méthode__ des [aiguilles de Buffon](https://fr.wikipedia.org/wiki/Aiguille_de_Buffon), on obtientdrait comme __approximation__ : " ] }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 2, "metadata": {}, "outputs": [ { @@ -54,7 +54,7 @@ "3.128911138923655" ] }, - "execution_count": 17, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -72,13 +72,29 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Avec un argument \"frésuentiel\" de surface\n", - "Sinon, une méthode plus simple à comprendre et ne faisant pas intervenir d'appel à la fonction sinus se base sur le fait que si $X \\sim \\mathcal{U}(0,1)$ et $Y \\sim \\mathcal{U}(0,1)$ alors $P\\left[X^2 + Y^2 \\leq 1\\right] = \\pi/4$\n" + "## Avec un argument \"fréquentiel\" de surface\n", + "Sinon, une méthode plus simple à comprendre et ne faisant pas intervenir d'appel à la fonction sinus se base sur le fait que si $X\\sim U(0,1)$ et $Y\\sim U(0,1)$ alors $P[X^2+Y^2\\leq 1] = \\pi/4$ (voir [méthode de Monte Carlo sur Wikipedia](https://fr.wikipedia.org/wiki/M%C3%A9thode_de_Monte-Carlo#D%C3%A9termination_de_la_valeur_de_%CF%80)). Le code suivant illustre ce fait :" ] }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "%matplotlib inline\n", + "import matplotlib.pyplot as plt\n", + "\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)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -95,15 +111,6 @@ } ], "source": [ - "%matplotlib inline\n", - "import matplotlib.pyplot as plt\n", - "import numpy as np\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", @@ -122,7 +129,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -131,7 +138,7 @@ "3.112" ] }, - "execution_count": 21, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } -- 2.18.1