diff --git a/module2/exo2/MOOC_RR_module2_Exo1.Rmd b/module2/exo2/MOOC_RR_module2_Exo1.Rmd index 99bb9fc0006d6195a2ed9a0d917a9af902c82b4b..fcfc404835bd1bbeead01570b146a5077fd6c31e 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) +```