Modifications mineures de toy_document_orgmode_R_fr.org

parent 79256fef
#+TITLE: À propos du calcul de \pi
#+TITLE: À propos du calcul de $\pi$
#+AUTHOR: Lionel Sicot
#+DATE: 20/10/2022
#+LANGUAGE: fr
# #+PROPERTY: header-args :eval never-export
#+PROPERTY: header-args :session :exports both
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="http://www.pirilampo.org/styles/readtheorg/css/htmlize.css"/>
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="http://www.pirilampo.org/styles/readtheorg/css/readtheorg.css"/>
......@@ -12,9 +12,9 @@
#+HTML_HEAD: <script type="text/javascript" src="http://www.pirilampo.org/styles/readtheorg/js/readtheorg.js"></script>
* En demandant à la lib maths
Mon ordinateur m'indique que \pi vaut /approximativement/
Mon ordinateur m'indique que $\pi$ vaut /approximativement/
#+begin_src R :results output :exports both
#+begin_src R :session *R* :results output :exports both
pi
#+end_src
......@@ -24,7 +24,7 @@ pi
* En utilisant la méthode des aiguilles de Buffon
Mais calculé avec la *méthode* des [[https://fr.wikipedia.org/wiki/Aiguille_de_Buffon][aiguilles de Buffon]], on obtiendrait comme *approximation* :
#+begin_src R :results output :exports both
#+begin_src R :session *R* :results output :exports both
set.seed(42)
N = 100000
x = runif(N)
......@@ -50,7 +50,7 @@ ggplot(df, aes(x=X,y=Y,color=Accept)) + geom_point(alpha=.2) + coord_fixed() + t
#+RESULTS:
[[file:MonteCarlo.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 :
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 :
#+begin_src R :session *R* :results output :exports both
4*mean(df$Accept)
#+end_src
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment