From 593b045d50bb3a7437073da92b232af18139a5ba Mon Sep 17 00:00:00 2001 From: e04f7876d60626fad04783b2a5fa00cd Date: Wed, 9 Sep 2026 15:09:41 +0000 Subject: [PATCH] Update toy_document_en.Rmd --- module2/exo1/toy_document_en.Rmd | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/module2/exo1/toy_document_en.Rmd b/module2/exo1/toy_document_en.Rmd index 61b2040..4064fc6 100644 --- a/module2/exo1/toy_document_en.Rmd +++ b/module2/exo1/toy_document_en.Rmd @@ -5,6 +5,7 @@ Date: 28.06.2026 output: html_document: --- +# A propos de pi ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) @@ -12,22 +13,27 @@ knitr::opts_chunk$set(echo = TRUE) ```{r} pi +``` - +```{r} set.seed(42) N = 100000 x = runif(N) theta = pi/2*runif(N) 2/(mean(x+sin(theta)>1)) +``` - - +```{r} set.seed(42) N = 1000 df = data.frame(X = runif(N), Y = runif(N)) 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() +``` + -*mean(df$Accept) \ No newline at end of file +```{r} +4*mean(df$Accept) +``` \ No newline at end of file -- 2.18.1