nag_quad_md_numth_coeff_prime (d01gy) calculates the optimal coefficients for use by
nag_quad_md_numth (d01gc) and
nag_quad_md_numth_vec (d01gd),
for prime numbers of points.
The
Korobov (1963) procedure for calculating the optimal coefficients
for
-point integration over the
-cube
imposes the constraint that
where
is a prime number and
is an adjustable argument. This argument is computed to minimize the error in the integral
when computed using the number theoretic rule, and the resulting coefficients can be shown to fit the Korobov definition of optimality.
The computation for large values of
is extremely time consuming (the number of elementary operations varying as
) and there is a practical upper limit to the number of points that can be used. Function
nag_quad_md_numth_coeff_2prime (d01gz) is computationally more economical in this respect but the associated error is likely to be larger.
None.
The optimal coefficients are returned as exact integers (though stored in a double array).
The time taken is approximately proportional to
(see
Description).
This example calculates the Korobov optimal coefficients where the number of dimensions is and the number of points is .
function d01gy_example
fprintf('d01gy example results\n\n');
ndim = int64(4);
npts = int64(631);
[vk, ifail] = d01gy(ndim, npts);
fprintf('Optimal coefficients:');
fprintf('%6d',vk);
fprintf('\n');