d01rgc is a general purpose integrator which calculates an approximation to the integral of a function over a finite interval :
The function is suitable as a general purpose integrator, and can be used when the integrand has singularities and infinities. In particular, the function can continue if the function f explicitly returns a quiet or signalling NaN or a signed infinity.
The function may be called by the names: d01rgc, nag_quad_dim1_fin_gonnet_vec or nag_quad_1d_fin_gonnet_vec.
d01rgc uses the algorithm described in Gonnet (2010). It is an adaptive algorithm, similar to the QUADPACK routine QAGS (see Piessens et al. (1983), see also d01rac) but includes significant differences regarding how the integrand is represented, how the integration error is estimated and how singularities and divergent integrals are treated. The local error estimation is described in Gonnet (2010).
d01rgc requires a function to evaluate the integrand at an array of different points and is, therefore, amenable to parallel execution.
Gonnet P (2010) Increasing the reliability of adaptive quadrature using explicit interpolants ACM Trans. Math. software37 26
Piessens R, de Doncker–Kapenga E, Überhuber C and Kahaner D (1983) QUADPACK, A Subroutine Package for Automatic Integration Springer–Verlag
1: – doubleInput
On entry: , the lower limit of integration.
2: – doubleInput
On entry: , the upper limit of integration. It is not necessary that .
Note: if , the function will immediately return with , and .
3: – function, supplied by the userExternal Function
f must return the value of the integrand at a set of points.
Pointer to structure of type Nag_Comm; the following members are relevant to f.
user – double *
iuser – Integer *
p – Pointer
The type Pointer will be void *. Before calling d01rgc you may allocate memory and initialize these pointers with various quantities for use by f when called from d01rgc (see Section 3.1.1 in the Introduction to the NAG Library CL Interface).
On exit: the error estimate of the definite integral f.
8: – Integer *Output
On exit: the total number of points at which the integrand, , has been evaluated.
9: – Nag_Comm *
The NAG communication argument (see Section 3.1.1 in the Introduction to the NAG Library CL Interface).
10: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
The requested accuracy was not achieved. Consider using larger values of epsabs and epsrel.
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, argument had an illegal value.
The integral is probably divergent or slowly convergent.
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
d01rgc cannot guarantee, but in practice usually achieves, the following accuracy:
and epsabs and epsrel are user-specified absolute and relative error tolerances. Moreover, it returns the quantity errest which, in normal circumstances, satisfies
8Parallelism and Performance
d01rgc is currently neither directly nor indirectly threaded. In particular, the user-supplied function f is not called from within a parallel region initialized inside d01rgc.
The user-supplied function f uses a vectorized interface, allowing for the required vector of function values to be evaluated in parallel; for example by placing appropriate OpenMP directives in the code for the user-supplied function f.
The time taken by d01rgc depends on the integrand and the accuracy required.
d01rgc is suitable for evaluating integrals that have singularities within the requested interval.
In particular, d01rgc accepts non-finite values on return from the user-supplied function f, and will adapt the integration rule accordingly to eliminate such points. Non-finite values include NaNs and infinities.