From 4f0cb399d7dbd7eb72194ea1b653f0b81d32076f Mon Sep 17 00:00:00 2001 From: e3e97d29a12734436c722a96738e732b Date: Thu, 22 Oct 2020 10:43:35 +0000 Subject: [PATCH] Update toy_document_en.Rmd --- module2/exo1/toy_document_en.Rmd | 1 + 1 file changed, 1 insertion(+) diff --git a/module2/exo1/toy_document_en.Rmd b/module2/exo1/toy_document_en.Rmd index 04ab5f5..02a6e7c 100644 --- a/module2/exo1/toy_document_en.Rmd +++ b/module2/exo1/toy_document_en.Rmd @@ -37,6 +37,7 @@ 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() + ``` It is then straightforward to obtain a (not really good) approximation to $\pi$ by counting how many times, on average, $X^2 + Y^2$ is smaller than 1: -- 2.18.1