Displaying 1 result from an estimated 1 matches for "estimatepi".
Did you mean:
estimate
2011 Oct 18
2
Remote environments, calling functions
Hi there,
I'm trying to do something like a migration of an R program. I've got a
function and some variables
in an interactive-session:
r <- .5
## estimatePi references r
estimatePi <- function(seed) {
set.seed(seed)
numDraws <- 1e+05
x <- runif(numDraws, min = -r, max = r)
y <- runif(numDraws, min = -r, max = r)
inCircle <- ifelse((x^2 + y^2)^0.5 < r, 1, 0)
sum(inCircle)/length(inCircle) * 4
}
At some point la...