diff --git a/module2/exo1/toy_notebook_fr.ipynb b/module2/exo1/toy_notebook_fr.ipynb index 8dff6084ebc06bd301728b3b13411e82862965fc..31178a1fbd8ebeff1b5e0d90c0ab7eba9e4dce9c 100644 --- a/module2/exo1/toy_notebook_fr.ipynb +++ b/module2/exo1/toy_notebook_fr.ipynb @@ -10,12 +10,34 @@ "\n", "## March 28, 2019\n", "\n", - "### **1 À propos du calcul de* $\\pi$\n", + "### **1 À propos du calcul de** $\\pi$\n", "\n", - "#### **1.1 En demandant à la lib maths\n", + "#### **1.1 En demandant à la lib maths**\n", "\n", "Mon ordinateur m'indique que $\\pi$ vaut *approximativement\n", - "\n" + "\n", + "In [1]: >from math import *\n", + " >print (pi)\n", + " \n", + " 3.141592653589793\n", + " \n", + "\n", + "#### **1.2 En utilisant la méthode des aiguilles de Buffon**\n", + "\n", + "Mais calculé avec la **méthode** des aiguilles de Buffon, on obtiendrait comme **approximation**\n", + "\n", + "In [2]: >import numpy as np\n", + " >np.random.seed(seed=42)\n", + " >N = 10000\n", + " >x = np.random.uniform(size=N, low=0, high=pi/2)\n", + " >2/(sum((x+np.sin(theta))>1)/N)\n", + " \n", + "Out[2]: 3.1289111389236548\n", + "\n", + "#### **1.3 Avec un argument \"fréquentiel\" de surface\n", + "\n", + "Sinon, une méthode plus simple à comprendre et ne faisant pas intervenir d'appel à la fonction\n", + "sinus se base sur le fait que si *X* $\\sim$ *U*(0,1) alors *P*[$X^2$ + $Y^2$ ≤ 1] = $^\\pi/_4$ (voir)" ] } ],