diff --git a/module2/exo1/toy_document_orgmode_python_fr.org b/module2/exo1/toy_document_orgmode_python_fr.org index af8b3eb53506940ecb367913152ea90b441334b7..9244c13ebb8ad93db02619da7dd62a97824924c5 100644 --- a/module2/exo1/toy_document_orgmode_python_fr.org +++ b/module2/exo1/toy_document_orgmode_python_fr.org @@ -36,10 +36,11 @@ theta = np.random.uniform(size=N, low=0, high=pi/2) #+end_src #+RESULTS: +: * Avec un argument "fréquentiel" de surface -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 ≤1]=\pi/4$ (voir [[https://fr.wikipedia.org/wiki/M%C3%A9thode_de_Monte-Carlo#D%C3%A9termination_de_la_valeur_de_%CF%80][méthode de Monte Carlo sur Wikipedia]]). Le code suivant illustre ce fait : +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 [[https://fr.wikipedia.org/wiki/M%C3%A9thode_de_Monte-Carlo#D%C3%A9termination_de_la_valeur_de_%CF%80][méthode de Monte Carlo sur Wikipedia]]). Le code suivant illustre ce fait : #+begin_src python :results output file :session :var matplot_lib_filename="./random_uniform_pi.png" :exports results import matplotlib.pyplot as plt @@ -63,10 +64,10 @@ print(matplot_lib_filename) #+end_src #+RESULTS: -[[File:random_uniform_pi.png]] +[[file:random_uniform_pi.png]] -Il est alors aisé d'obtenir une approximation (pas terrible) de π en comptant combien de fois, en moyenne, X^2+Y^2 est inférieur à 1 : +Il est alors aisé d'obtenir une approximation (pas terrible) de $π$ en comptant combien de fois, en moyenne, $X^2+Y^2$ est inférieur à 1 : #+begin_src python :results output :session :exports both 4*np.mean(accept)