R2Cuba
Multidimensional Numerical Integration |
---|
> library("R2Cuba") > integrand <- function(arg, weight) { > x <- arg[1] > y <- arg[2] > z <- arg[3] > ff <- sin(x)*cos(y)*exp(z); > return(ff) > } # end integrand > NDIM <-3 > NCOMP <- 1 > vegas(NDIM, NCOMP, integrand, rel.tol=1e-3, abs.tol=1e-12)Output:
Iteration 1: 1000 integrand evaluations so far [1] 0.664916 +- 0.0138647 chisq 0 (0 df) Iteration 2: 2500 integrand evaluations so far [1] 0.664007 +- 0.00474411 chisq 0.0038488 (1 df) Iteration 3: 4500 integrand evaluations so far [1] 0.664383 +- 0.00188845 chisq 0.00717154 (2 df) Iteration 4: 7000 integrand evaluations so far [1] 0.665508 +- 0.000860144 chisq 0.368573 (3 df) Iteration 5: 10000 integrand evaluations so far [1] 0.664489 +- 0.000639334 chisq 0.990089 (4 df) integral: 0.664489 (+-0.00064) number of evaluations: 10000; probability: 0.08870493
Copyright © 2009-
INRA. All rights reserved.
Licence
R2Cuba is an open source, freely available software released under
the GPL-3 Licence.
Requirements
R
system, -- including C compiler --, and
the R-packages: methods, stats.
Documentation
Documentation is included.
Download
- from the CRAN
- R2Cuba_1.1-1.tar.gz (2017-01-27)
Contact
Annie.Bouvier at
inra.fr