naginterfaces.library.quad.md_​numth_​coeff_​2prime

naginterfaces.library.quad.md_numth_coeff_2prime(ndim, np1, np2)[source]

md_numth_coeff_2prime calculates the optimal coefficients for use by md_numth() and md_numth_vec(), when the number of points is the product of two primes.

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

https://www.nag.com/numeric/nl/nagdoc_29.3/flhtml/d01/d01gzf.html

Parameters
ndimint

, the number of dimensions of the integral.

np1int

The larger prime factor of the number of points in the integration rule.

np2int

The smaller prime factor of the number of points in the integration rule. For maximum efficiency, should be close to .

Returns
vkfloat, ndarray, shape

The optimal coefficients.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, exceeds largest machine integer. and .

(errno )

On entry, .

Constraint: must be a prime number.

(errno )

On entry, .

Constraint: must be a prime number.

Warns
NagAlgorithmicWarning
(errno )

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

Notes

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 md_numth_coeff_prime(). The associated error is likely to be larger although it may be the only practical alternative for high values of .

References

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