diff --git a/module2/exo1/toy_notebook_fr.ipynb b/module2/exo1/toy_notebook_fr.ipynb index d348d0fce9c96bfd5bb1afe8dc3da97e9ec826f7..335cdd4a773780a303e5685caab7b0779535286a 100644 --- a/module2/exo1/toy_notebook_fr.ipynb +++ b/module2/exo1/toy_notebook_fr.ipynb @@ -18,26 +18,26 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## À propos du calcul de $\\pi$ " + "# À propos du calcul de $\\pi$ " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "### En demandant à la lib maths" + "## En demandant à la lib maths" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Mon ordinateur m’indique que $\\pi$ vaut approximativement" + "Mon ordinateur m’indique que $\\pi$ vaut *approximativement*" ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -49,7 +49,7 @@ } ], "source": [ - "from math import * \n", + "from math import *\n", "print(pi)" ] }, @@ -57,7 +57,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### En utilisant la méthode des aiguilles de Buffon " + "## En utilisant la méthode des aiguilles de Buffon " ] }, { @@ -69,7 +69,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 10, "metadata": { "scrolled": true }, @@ -80,17 +80,17 @@ "3.128911138923655" ] }, - "execution_count": 6, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "import numpy as np \n", - "np.random.seed(seed=42) \n", - "N = 10000 \n", - "x = np.random.uniform(size=N, low=0, high=1) \n", - "theta = np.random.uniform(size=N, low=0, high=pi/2) \n", + "import numpy as np\n", + "np.random.seed(seed=42)\n", + "N = 10000\n", + "x = np.random.uniform(size=N, low=0, high=1)\n", + "theta = np.random.uniform(size=N, low=0, high=pi/2)\n", "2/(sum((x+np.sin(theta))>1)/N)" ] }, @@ -98,7 +98,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Avec un argument \"fréquentiel\" de surface " + "## Avec un argument \"fréquentiel\" de surface " ] }, { @@ -113,7 +113,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -130,19 +130,19 @@ } ], "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", + "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", - "accept = (x*x+y*y) <= 1 \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", + "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", "ax.set_aspect('equal')" ] }, @@ -156,7 +156,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 12, "metadata": { "scrolled": true }, @@ -167,7 +167,7 @@ "3.112" ] }, - "execution_count": 8, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" }