d01gy calculates the optimal coefficients for use by (D01GCF not in this release) d01gd, for prime numbers of points.
Public Shared Sub d01gy ( _ ndim As Integer, _ npts As Integer, _ vk As Double(), _ <OutAttribute> ByRef ifail As Integer _ )
public: static void d01gy( int ndim, int npts, array<double>^ vk, [OutAttribute] int% ifail )
- Type: System..::..Int32On entry: , the number of dimensions of the integral.Constraint: .
- Type: System..::..Int32On entry: , the number of points to be used.Constraint: must be a prime number .
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 parameter. This parameter 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. Method d01gz is computationally more economical in this respect but the associated error is likely to be larger.
Korobov N M (1963) Number Theoretic Methods in Approximate Analysis Fizmatgiz, Moscow
Errors or warnings detected by the method:
On entry, . On entry, . On entry, npts is not a prime number.
- The precision of the machine is insufficient to perform the computation exactly. Try a smaller value of npts, or use an implementation of higher precision.
The optimal coefficients are returned as exact integers (though stored in a real 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 .