diff --git a/module2/exo1/toy_document_orgmode_python_fr.org b/module2/exo1/toy_document_orgmode_python_fr.org index d62c2befe1da522f2313492326f84978d5c6b431..a5195d7fff753b6ae4a83c567ccce434759623ce 100644 --- a/module2/exo1/toy_document_orgmode_python_fr.org +++ b/module2/exo1/toy_document_orgmode_python_fr.org @@ -11,6 +11,8 @@ #+HTML_HEAD: #+HTML_HEAD: +#+TOC: headlines 1 + * En demandant à lib maths Mon ordinateur m'indique que π vaut /approximativement/: @@ -47,7 +49,7 @@ 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] = π/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 file :session :var matplot_lib_filename="./figure.png" :exports both +#+begin_src python :results output file :session :var matplot_lib_filename="./figure.png" :exports both import matplotlib.pyplot as plt np.random.seed(seed=42) @@ -68,7 +70,8 @@ print(matplot_lib_filename) #+end_src #+RESULTS: -[[file:]] +[[file:./figure.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$ :