suave {R2Cuba} | R Documentation |
Suave uses vegas
-like importance sampling combined
with a globally adaptive subdivision strategy: Until the requested accuracy is reached,
the region with the largest error at the time is bisected in the dimension in which the
fluctuations of the integrand are reduced most. The number of new samples in each half
is prorated for the fluctuation in that half.
suave(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, nnew=1000, flatness= 50)
ndim |
same as cuhre |
ncomp |
same as cuhre |
integrand |
same as cuhre ;
But, here, the input argument phw
contains the weight of the point being sampled.
This
extra value can safely be
ignored.
|
... |
same as cuhre |
lower |
same as cuhre |
upper |
same as cuhre |
rel.tol |
same as cuhre |
abs.tol |
same as cuhre |
flags |
same as cuhre .
flags may have an additional component:
smooth . When = 0 , apply additional smoothing to the importance
function, this moderately improves convergence for many integrands.
When = 1 , use the importance function without smoothing, this should be chosen
if the integrand has sharp edges.
|
min.eval |
same as cuhre |
max.eval |
same as cuhre |
nnew |
the number of new integrand evaluations in each subdivision. |
flatness |
This parameter determines how
prominently “outliers”, i.e. individual samples with a large
fluctuation,
figure in the total fluctuation,
which in turn determines how a region is split up. As suggested by its name, flatness
should be chosen large for “flat” integrands and small for “volatile”
integrands with
high peaks. Note that since flatness appears in the exponent, one should not use
too large values (say, no more than a few hundred) lest terms be truncated internally
to prevent overflow. More details about this parameter can be found
Hahn's paper from 2005 and in Cuba documentation. |
See details in the documentation.dériv
Idem as cuhre
T. Hahn (2005) CUBA-a library for multidimensional numerical integration. Computer Physics Communications, 168, 78-95.
integrand <- function(arg, weight) { x <- arg[1] y <- arg[2] z <- arg[3] ff <- sin(x)*cos(y)*exp(z); return(ff) } # end integrand suave(3, 1, integrand, rel.tol=1e-3, abs.tol=1e-12, flags=list(verbose=2, final=0))