nag_quad_md_numth_coeff_prime (d01gyc) calculates the optimal coefficients for use by
for prime numbers of points.
The Korobov (1963)
procedure for calculating the optimal coefficients
-point integration over the
imposes the constraint that
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 (d01gzc)
is computationally more economical in this respect but the associated error is likely to be larger.
The optimal coefficients are returned as exact integers (though stored in a double array).
The time taken is approximately proportional to
(see Section 3
This example calculates the Korobov optimal coefficients where the number of dimensions is and the number of points is .