p(sum(cos(2*pi*x), 2));
dim=2; absTol=1e-3; relTol=1e-2;
exactInteg = besseli(0,1)^dim;
inputArgs = {<span class="string">'absTol'</span>,absTol,<span class="string">'relTol'</span>,relTol};
[~,muhat]=cubBayesNet_g(fun, dim, inputArgs{:});
check = double(abs(exactInteg-muhat) &lt; max(absTol,relTol*abs(exactInteg)))
</pre><pre class="codeoutput">
check =

     1

</pre><p><b>Example 3: Keister function</b></p><p>Estimate the Keister's integrand, a multidimensional integral inspired by a physics application 