nag_quad_md_numth_coeff_2prime (d01gz) calculates the optimal coefficients for use by
nag_quad_md_numth (d01gc) and
nag_quad_md_numth_vec (d01gd),
when the number of points is the product of two primes.
Korobov (1963) gives a procedure for calculating optimal coefficients for
-point integration over the
-cube
, when the number of points is
where
and
are distinct prime numbers.
The advantage of this procedure is that if
is chosen to be the nearest prime integer to
, then the number of elementary operations required to compute the rule is of the order of
which grows less rapidly than the number of operations required by
nag_quad_md_numth_coeff_prime (d01gy). The associated error is likely to be larger although it may be the only practical alternative for high values of
.
None.
The optimal coefficients are returned as exact integers (though stored in a double array).
The time taken by
nag_quad_md_numth_coeff_2prime (d01gz) grows at least as fast as
. (See
Description.)
This example calculates the Korobov optimal coefficients where the number of dimensons is and the number of points is the product of the two prime numbers, and .
function d01gz_example
fprintf('d01gz example results\n\n');
ndim = int64(4);
np1 = int64(89);
np2 = int64(11);
[vk, ifail] = d01gz(ndim, np1, np2);
fprintf('Optimal coefficients:');
fprintf('%6d',vk);
fprintf('\n');