diff --git a/module2/exo1/toy_notebook_fr.ipynb b/module2/exo1/toy_notebook_fr.ipynb index 1ac5adde0649826e8408f15e3afc38fedc9fc612..c806c93e1f6d5a9a3b4f6076d10d1535b9c230e4 100644 --- a/module2/exo1/toy_notebook_fr.ipynb +++ b/module2/exo1/toy_notebook_fr.ipynb @@ -4,23 +4,17 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# À propos de pi" + "### Estimating π\n", + "\n", + "I tried to compute pi using Buffon’s Needle method with random numbers to estimate the value of π. \n", + "The result is close to 3.14, showing how randomness can be used in simulations." ] }, { - "cell_type": "code", - "execution_count": 1, + "cell_type": "markdown", "metadata": {}, - "outputs": [], "source": [ - "from random import random \n", - "N=10000\n", - "val=sum(\n", - "1 for _ in range(N)\n", - " if random()**2 + random()**2 <= 1\n", - ")\n", - "\n", - "pi_estimate = 4 * val / N" + "# About Pi" ] }, { @@ -34,6 +28,22 @@ "Donc : $\\pi \\approx 4 \\times \\frac{\\text{points dans le cercle}}{\\text{points totaux}}$\n" ] }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "from random import random \n", + "N=10000\n", + "val=sum(\n", + "1 for _ in range(N)\n", + " if random()**2 + random()**2 <= 1\n", + ")\n", + "\n", + "pi_estimate = 4 * val / N" + ] + }, { "cell_type": "code", "execution_count": 8,