From f6db51e57d78ce0215673cf2c4767d9094c3abd5 Mon Sep 17 00:00:00 2001 From: da377e3b0960a14b082c0f46b9a54abd Date: Tue, 13 Jun 2023 13:01:59 +0000 Subject: [PATCH] Update MOOC_RR_module2_Exo1.Rmd --- module2/exo2/MOOC_RR_module2_Exo1.Rmd | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/module2/exo2/MOOC_RR_module2_Exo1.Rmd b/module2/exo2/MOOC_RR_module2_Exo1.Rmd index 99bb9fc..fcfc404 100644 --- a/module2/exo2/MOOC_RR_module2_Exo1.Rmd +++ b/module2/exo2/MOOC_RR_module2_Exo1.Rmd @@ -46,3 +46,8 @@ df$Accept = (df$X**2 + df$Y**2 <=1) library(ggplot2) ggplot(df, aes(x=X,y=Y,color=Accept)) + geom_point(alpha=.2) + coord_fixed() + theme_bw() ``` +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: + +```{r} +4*mean(df$Accept) +``` -- 2.18.1