I would like to compute the triple integral of a function of three variables $f(x,y,z)$in R. I am using the packageCubature, Base, SimplicialCubatureand the functionadaptIntegrate(), IntegrateandadaptIntegrateSimplex().The integrand is equal to1only in certain domain(x<y<z, 0 otherwise).Followings are the different ways to answer this question but i didn't understand how to compute the answer 0.166666 manually. If any member knows the answer, may reply. Using

Cubaturepackage,

Usinglibrary(cubature)

lower <- rep(0,3)

upper <- rep(1,3)

# First implementation (modified)

fxyz <- function(w) {

x <- w[1]

y <- w[2]

z <- w[3]

as.numeric(x <= y)*as.numeric(y <= z)

}

adaptIntegrate(f=fxyz,lowerLimit=lower,upperLimit= upper,doChecking=TRUE, maxEval=2000000,absError=10e-5,tol=1e-5)Basepackage in R,

Usingf.xyz <- function(x, y, z) ifelse(x < y & y < z, 1, 0)

f.yz <- Vectorize(function(y, z) integrate(f.xyz, 0, 1, y=y, z=z)\$value,

vectorize.args="y")

f.z <- Vectorize(function(z) integrate(f.yz, 0, 1, z=z)\$ value,

vectorize.args="z")

integrate(f.z, 0, 1)SimplicialCubaturepackage in R,

The integral is 0.1666667 but i don't understand how is that computed? If any member knows may reply with correct answer.library(SimplicialCubature)

f <- function(x) 1

S <- CanonicalSimplex(3)

> adaptIntegrateSimplex(function(x) 1, S)