vegas(ndim, ncomp, integrand, ..., lower=rep(0,ndim), upper=rep(1,ndim), rel.tol= 0.001, abs.tol = 0, flags=list(verbose=1, final=1, pseudo.random=0, smooth=0, mersenne.seed=NULL), min.eval=0, max.eval=50000, nstart=1000, nincrease=500, nbatch=1000, gridno=0, state.file=NULL)
cuhre
cuhre
cuhre
;
But, here, the input argument phw
contains the weight of the point being sampled.
This
extra value can safely be
ignored.
cuhre
cuhre
cuhre
cuhre
cuhre
cuhre
.
But flags
may have an additional component:
smooth
. When smooth = 0
, apply additional smoothing to the importance
function, this moderately improves convergence for many integrands.
When smooth = 1
, use the importance function without smoothing, this should be chosen
if the integrand has sharp edges.Note: Value 3 of flags$verbose
has the same effect as
value 2 (Vegas does not partition the integration region).
cuhre
cuhre
nbatch
is the number of
points sampled in each batch. Tuning this number should usually not be necessary as performance
is affected significantly
only as far as the batch of samples fits into the CPU cache.gridno
is a number between 1 and 10, the grid is not discarded at the end of
the integration, but stored in the respective slot of the table for a future invocation.
The grid is only re-used if the dimension of the subsequent integration is the same
as the one it originates from.
In repeated invocations it may become necessary to flush a slot in memory. In this
case the negative of the grid number should be set. Vegas will then start with a new
grid and also restore the grid number to its positive value, such that at the end of
the integration the grid is again stored in the indicated slot.The state file is updated after every iteration. If, on a subsequent invocation, Vegas finds a file of the specified name, it loads the internal state and continues from the point it left off. Needless to say, using an existing state file with a different integrand generally leads to wrong results. Once the integration finishes successfully, i.e. the prescribed accuracy is attained, the state file is removed. This feature is useful mainly to define check-points in long-running integrations from which the calculation can be restarted.
cuhre
, except from nregions
(not present)
T. Hahn (2005) CUBA-a library for multidimensional numerical integration. Computer Physics Communications, 168, 78-95.
cuhre
, suave
, divonne
integrand <- function(arg, weight) {
x <- arg[1]
y <- arg[2]
z <- arg[3]
ff <- sin(x)*cos(y)*exp(z);
return(ff)
} # end integrand
vegas(3, 1, integrand, rel.tol=1e-3, abs.tol=1e-12, flags=list(verbose=2))
Run the code above in your browser using DataLab