we define the product function over the d-dimensional space as the product of the components of any point.

for example, product(.2) = .2, product([0.5,0.5,0.5]) = 0.125

if we integrate product over the unit interval [0,1], we get 1/2

if we integrate product over the unit square, with corners (0,0) and (1,1), we get 1/4

if we integrate product over the unit cube, we get 1/8

if we integrate product over the unit d-dimensional hypercube, we get 2^-d

notice that in high dimensions, this function has a very narrow peak which can trip up numerical integration methods.

therefore it is a good way to test how good a numerical integrator is.

we measure error of a numerical integrator as follows:

if the integrator returns some value y, and the actual solution is w, we say error is y/w-1

in the below graph, the x-axis is the number of dimensions

the y-axis is the error as computed previously

the blue line represents a perfect symbolic integrator

the red line is a non-adaptive monte carlo integrator

the green line is an adaptive monte carlo integrator (VEGAS) which i used from this python library which is really nice

parameters were set so that both numerical integrators sampled 150000 points

we can see that up to 12 dimensions or so, the adaptive integrator is off by no more than one part in a thousand