Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mooc-rr
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
a3ae0c888bdf60959264517358bb4f12
mooc-rr
Commits
12700456
Commit
12700456
authored
Nov 02, 2024
by
Jade Bolaty
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correction de quelques éléments
parent
cf586cd9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
toy_document_orgmode_R_fr.org
module2/exo1/toy_document_orgmode_R_fr.org
+7
-7
No files found.
module2/exo1/toy_document_orgmode_R_fr.org
View file @
12700456
#+TITLE: À propos du calcul de
\pi
#+TITLE: À propos du calcul de
$\pi$
#+AUTHOR: Arnaud Legrand
#+DATE: <2024-11-02 sam.>
#+LANGUAGE: fr
...
...
@@ -19,7 +19,7 @@
* <<uno>>1 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 :session *R* :exports both
pi
...
...
@@ -47,10 +47,10 @@ theta = pi/2*runif(N)
* <<tres>>3 Avec un argument "fréquentiel" de surface
Sinon, une méthode plus simple à comprendre et ne faisant pas
intervenir d'appel à lz fonction sinus se base sur le fait que si
*/X ~
U(0,1)
/* et */Y ~ U(0,1)/* alors */P[X² + Y² <= 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
intervenir d'appel à lz fonction sinus se base sur le fait que si
$X \sim
U(0,1)
$ et $Y \sim U(0,1)$ alors $P[X² + Y² <= 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 R :results file graphics :file
(org-babel-temp-file "figure" ".png")
:exports both :width 600 :height 400 :session *R*
#+begin_src R :results file graphics :file
figure_pi_mc1.png
:exports both :width 600 :height 400 :session *R*
set.seed(42)
N = 1000
df = data.frame(X = runif(N), Y = runif(N))
...
...
@@ -61,8 +61,8 @@ ggplot(df, aes(x=X,y=Y,color=Accept)) + geom_point(alpha=.2) + coord_fixed() + t
#+RESULTS:
[[file:c:/Users/Jade/AppData/Local/Temp/babel-B2M9M4/figuredgJtpV.png]]
Il est alors aisé d'obtenir une approximation (pas terrible) de
\pi
en
comptant combien de fois, en moyenne,
*/X² + Y²/*
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 :results output :session *R* :exports both
4*mean(df$Accept)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment