The Cuba library is described at
http://www.feynarts.de/cuba/.
User documentation is available in T. Hahn (2005) CUBA-a library for multidimensional numerical
integration. Computer Physics Communications, 168,
78-95. (http://arxiv.org/pdf/hep-ph/0404043).
See Also
The R-package “cubature”
Examples
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)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(R2Cuba)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/R2Cuba/R2Cuba-package.Rd_%03d_medium.png", width=480, height=480)
> ### Name: R2Cuba-package
> ### Title:
> ### Sexpr[results=rd,stage=build]{tools:::Rd_package_title("R2Cuba")}
> ### Aliases: R2Cuba-package R2Cuba
> ### Keywords: package
>
> ### ** Examples
>
> 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)
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
>
>
>
>
>
> dev.off()
null device
1
>