INRA logo MaIAGE     

R2Cuba
Multidimensional Numerical Integration

What is R2Cuba?

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

The interface between R and the Cuba library is developed in the MaIAGE Lab. of INRA - Jouy-en-Josas, France.

Authors

Bouvier A., Kiêu K. (INRA, Jouy-en-Josas, France).

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).

Example

In a R session:
> 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 

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