powered by
Mean Value Method
SI.MVM(h, from, to, N)
Density function to be integrated
The start point
The end point
The number of trials
Approximated integration
Estimated variance
# NOT RUN { ## To integrate exp(x) from -1 to 1 set.seed(0) h <- function(x){ exp(x) } N <- 100000 MVMresult <- SI.MVM(h,-1,1,N) I2 <- MVMresult[[1]] VarI2 <- MVMresult[[2]] # }
Run the code above in your browser using DataLab