Rmarkdown test page
Some math
\[\pi(\varphi) = \int \varphi(x) \pi({\rm d}x).\]
Here we are testing RMarkdown rendering.
mc <- function(mu, f, N) {
v = 0.0
for (i in 1:N) {
x <- mu()
v <- v + f(x)
}
return(v/N)
}
unif <- function() {
return(runif(1))
}
g = sin
N <- 1000
system.time(y <- mc(unif, g, N))
## user system elapsed
## 0.026 0.002 0.028
print(paste(y, ", ", 1.0 - cos(1.0)))
## [1] "0.462408271782392 , 0.45969769413186"