search for: incircl

Displaying 1 result from an estimated 1 matches for "incircl".

Did you mean: incircle
2011 Oct 18
2
Remote environments, calling functions
...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 later (in C) I package all this up and send it somewhere else, where deserialize it (with care): > ls(env) [1] "echoBack" "estimatePi" "r" > env$estimatePi func...