R2Cuba-package: Multidimensional Numerical Integration

Description Author(s) References See Also Examples

Description

It is a wrapper around the Cuba-1.6 library by Thomas Hahn available from the URL http://www.feynarts.de/cuba/. Implement four general-purpose multidimensional integration algorithms: Vegas, Suave, Divonne and Cuhre.

Author(s)

The Cuba library has been written by Thomas Hahn (http://wwwth.mppmu.mpg.de/members/hahn); Interface to R was written by Annie Bouvier and Ki<c3><aa>n Ki<c3><aa>u

Maintainer: Annie Bouvier <Annie.Bouvier@jouy.inra.fr>

References

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)

Example 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 

R2Cuba documentation built on May 29, 2017, 7:53 p.m.