md_numth_coeff_prime calculates the optimal coefficients for use by md_numth() and md_numth_vec(), for prime numbers of points.

For full information please refer to the NAG Library document for d01gy

https://www.nag.com/numeric/nl/nagdoc_28.7/flhtml/d01/d01gyf.html

Parameters
ndimint

, the number of dimensions of the integral.

nptsint

, the number of points to be used.

Returns
vkfloat, ndarray, shape

The optimal coefficients.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: must be a prime number.

Warns
NagAlgorithmicWarning
(errno )

The machine precision is insufficient to perform the computation exactly. Try reducing : .

Notes

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 md_numth_coeff_2prime() is computationally more economical in this respect but the associated error is likely to be larger.

References

Korobov, N M, 1963, Number Theoretic Methods in Approximate Analysis, Fizmatgiz, Moscow