diff --git a/module2/exo1/3.png b/module2/exo1/figure_pi_mc2.png similarity index 100% rename from module2/exo1/3.png rename to module2/exo1/figure_pi_mc2.png diff --git a/module2/exo1/toy_document_orgmode_python_fr.org b/module2/exo1/toy_document_orgmode_python_fr.org index 79c8fa3885a142e5bab409201787c8bf8074eca4..1db41e20f1e4e938611d932375c21c3d4845ec1e 100644 --- a/module2/exo1/toy_document_orgmode_python_fr.org +++ b/module2/exo1/toy_document_orgmode_python_fr.org @@ -36,7 +36,7 @@ Sinon, une méthode plus simple à comprendre et ne faisant pas intervenir d'app alors $P[X^2+Y^2 \le 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 file :exports both :session 56abdee0-bba4-444e-8742-69eb45eb597e +#+BEGIN_SRC python :results file :var matplot_lib_filename="figure_pi_mc2.png" :exports both :session 56abdee0-bba4-444e-8742-69eb45eb597e import matplotlib.pyplot as plt np.random.seed(seed=42) @@ -52,7 +52,6 @@ ax.scatter(x[accept], y[accept], c='b', alpha=0.2, edgecolor=None) ax.scatter(x[reject], y[reject], c='r', alpha=0.2, edgecolor=None) ax.set_aspect('equal') -matplot_lib_filename = "3.png" plt.savefig(matplot_lib_filename) matplot_lib_filename #+END_SRC @@ -60,7 +59,7 @@ matplot_lib_filename #+attr_html: :width 640px :height 480px #+attr_latex: :width 640px :height 480px #+RESULTS: -[[file:3.png]] +[[file:figure_pi_mc2.png]] Il est alors aisé d'obtenir une approximation (pas terrible) de $\pi$ en comptant combien de fois, en moyenne, $X^2+Y^2$ est inférieur à 1 :