diff --git a/module2/exo1/toy_document_orgmode_python_en.org b/module2/exo1/toy_document_orgmode_python_en.org index 52dc9e798a2b20e30306ca44c706d2cdb7045693..1184cc3ac717bd36de92c4a47b48a700a9497b2f 100644 --- a/module2/exo1/toy_document_orgmode_python_en.org +++ b/module2/exo1/toy_document_orgmode_python_en.org @@ -1,4 +1,4 @@ -#+TITLE: On the computation of pi +#+TITLE: On the computation of pi #+LANGUAGE: en #+HTML_HEAD: @@ -8,12 +8,10 @@ #+HTML_HEAD: #+HTML_HEAD: -# #+PROPERTY: header-args :eval never-export - -* Table of Contents +# #+PROPERTY: header-args :session :exports both * Asking the math library -My computer tells me that \pi is /approximatively/ +My computer tells me that $\pi$ is /approximatively/ #+begin_src python :results value :session :exports both from math import * @@ -24,8 +22,7 @@ pi : 3.141592653589793 * * Buffon's needle -Applying the method of -[[https://en.wikipedia.org/wiki/Buffon%2527s_needle_problem][Buffon's needle]] we get the *approximation* +Applying the method of [[https://en.wikipedia.org/wiki/Buffon%2527s_needle_problem][Buffon's needle]], we get the *approximation* #+begin_src python :results value :session :exports both import numpy as np @@ -42,10 +39,7 @@ theta = np.random.uniform(size=N, low=0, high=pi/2) * Using a surface fraction argument A method that is easier to understand and does not make use of the -$\sin$ function is based on the fact that if $X ~ U(0,1)$ and $Y ~ -U(0,1)$, then $P[X^2 + Y^2 \leq 1] = \pi/4$ (see -[[https://en.wikipedia.org/wiki/Monte_Carlo_method]["Monte Carlo -Method" on Wikipedia]]). The following code uses this approach: +$\sin$ function is based on the fact that if $X \sim U(0,1)$ and $Y \sim U(0,1)$, then $P[X^2 + Y^2 \leq 1] = \pi/4$ (see [[https://en.wikipedia.org/wiki/Monte_Carlo_method]["Monte Carlo Method" on Wikipedia]]). The following code uses this approach: #+begin_src python :results output file :session :var matplot_lib_filename="figure_pi_mc2.png" :exports both import matplotlib.pyplot as plt