hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_quad_md_numth_coeff_prime (d01gy)

Purpose

nag_quad_md_numth_coeff_prime (d01gy) calculates the optimal coefficients for use by nag_quad_md_numth (d01gc) and nag_quad_md_numth_vec (d01gd), for prime numbers of points.

Syntax

[vk, ifail] = d01gy(ndim, npts)
[vk, ifail] = nag_quad_md_numth_coeff_prime(ndim, npts)

Description

The Korobov (1963) procedure for calculating the optimal coefficients a1,a2,,ana1,a2,,an for pp-point integration over the nn-cube [0,1]n[0,1]n imposes the constraint that
a1 = 1  and  ai = ai1( mod p),  i = 1,2,,n
a1=1  and  ai=ai-1( mod p),  i=1,2,,n
(1)
where pp is a prime number and aa is an adjustable parameter. This parameter is computed to minimize the error in the integral
1 1 n
3ndx1dxn(12xi)2,
0 0 i = 1
3n01dx101dxni=1n (1-2xi) 2,
(2)
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 pp is extremely time consuming (the number of elementary operations varying as p2p2) and there is a practical upper limit to the number of points that can be used. Function nag_quad_md_numth_coeff_2prime (d01gz) 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

Parameters

Compulsory Input Parameters

1:     ndim – int64int32nag_int scalar
nn, the number of dimensions of the integral.
Constraint: ndim1ndim1.
2:     npts – int64int32nag_int scalar
pp, the number of points to be used.
Constraint: nptsnpts must be a prime number 55.

Optional Input Parameters

None.

Input Parameters Omitted from the MATLAB Interface

None.

Output Parameters

1:     vk(ndim) – double array
The nn optimal coefficients.
2:     ifail – int64int32nag_int scalar
ifail = 0ifail=0 unless the function detects an error (see [Error Indicators and Warnings]).

Error Indicators and Warnings

Errors or warnings detected by the function:

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

  ifail = 1ifail=1
On entry,ndim < 1ndim<1.
  ifail = 2ifail=2
On entry,npts < 5npts<5.
  ifail = 3ifail=3
On entry,npts is not a prime number.
W ifail = 4ifail=4
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.

Accuracy

The optimal coefficients are returned as exact integers (though stored in a double array).

Further Comments

The time taken is approximately proportional to p2p2 (see Section [Description]).

Example

function nag_quad_md_numth_coeff_prime_example
ndim = int64(4);
npts = int64(631);
[vk, ifail] = nag_quad_md_numth_coeff_prime(ndim, npts)
 

vk =

     1
   198
    82
   461


ifail =

                    0


function d01gy_example
ndim = int64(4);
npts = int64(631);
[vk, ifail] = d01gy(ndim, npts)
 

vk =

     1
   198
    82
   461


ifail =

                    0



PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2013