The function may be called by the names: d01spc, nag_quad_dim1_quad_wt_alglog_1 or nag_1d_quad_wt_alglog_1.
3Description
d01spc is based upon the QUADPACK routine QAWSE (Piessens et al. (1983)) and integrates a function of the form , where the weight function may have algebraico-logarithmic singularities at the end-points and/or . The strategy is a modification of that in d01skc. We start by bisecting the original interval and applying modified Clenshaw–Curtis integration of orders 12 and 24 to both halves. Clenshaw–Curtis integration is then used on all sub-intervals which have or as one of their end-points (Piessens et al. (1974)). On the other sub-intervals Gauss–Kronrod (7–15 point) integration is carried out.
On entry: the point at which the function must be evaluated.
2: – Nag_User *
Pointer to a structure of type Nag_User with the following member:
p – Pointer
On entry/exit: the pointer should be cast to the required type, e.g.,
struct user *s = (struct user *)comm → p, to obtain the original object's address with appropriate type. (See the argument comm below.)
Note:g should not return floating-point NaN (Not a Number) or infinity values, since these are not handled by d01spc. If your code inadvertently does return any NaNs or infinities, d01spc is likely to produce unexpected results.
2: – doubleInput
On entry: the lower limit of integration, .
3: – doubleInput
On entry: the upper limit of integration, .
Constraint:
.
4: – doubleInput
On entry: the argument in the weight function.
Constraint:
.
5: – doubleInput
On entry: the argument in the weight function.
Constraint:
.
6: – Nag_QuadWeightInput
On entry: indicates which weight function is to be used:
if , ;
if , ;
if , ;
if , .
Constraint:
, , or .
7: – doubleInput
On entry: the absolute accuracy required. If epsabs is negative, the absolute value is used. See Section 7.
8: – doubleInput
On entry: the relative accuracy required. If epsrel is negative, the absolute value is used. See Section 7.
9: – IntegerInput
On entry: the upper bound on the number of sub-intervals into which the interval of integration may be divided by the function. The more difficult the integrand, the larger max_num_subint should be.
Constraint:
.
10: – double *Output
On exit: the approximation to the integral .
11: – double *Output
On exit: an estimate of the modulus of the absolute error, which should be an upper bound for .
12: – Nag_QuadProgress *
Pointer to structure of type Nag_QuadProgress with the following members:
num_subint – IntegerOutput
On exit: the actual number of sub-intervals used.
fun_count – IntegerOutput
On exit: the number of function evaluations performed by d01spc.
Before a subsequent call to d01spc is made, or when the information contained in these arrays is no longer useful, you should free the storage allocated by these pointers using the NAG macro NAG_FREE.
13: – Nag_User *
Pointer to a structure of type Nag_User with the following member:
p – Pointer
On entry/exit: the pointer , of type Pointer, allows you to communicate information to and from g(). An object of the required type should be declared, e.g., a structure, and its address assigned to the pointer by means of a cast to Pointer in the calling program, e.g., comm.p = (Pointer)&s. The type Pointer is void *.
14: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
Extremely bad integrand behaviour occurs around the sub-interval .
The same advice applies as in the case of NE_QUAD_MAX_SUBDIV.
NE_QUAD_MAX_SUBDIV
The maximum number of subdivisions has been reached: .
The maximum number of subdivisions has been reached without the accuracy requirements being achieved. Look at the integrand in order to determine the integration difficulties. If the position of a discontinuity or a singularity of algebraico-logarithmic type within the interval can be determined, the interval must be split up at this point and the integrator called on the sub-intervals. If necessary, another integrator, which is designed for handling the type of difficulty involved, must be used. Alternatively, consider relaxing the accuracy requirements specified by epsabs and epsrel, or increasing the value of max_num_subint.
NE_QUAD_ROUNDOFF_TOL
Round-off error prevents the requested tolerance from being achieved: , .
The error may be underestimated. Consider relaxing the accuracy requirements specified by epsabs and epsrel.
NE_REAL_ARG_LE
On entry, .
Constraint: .
On entry, .
Constraint: .
7Accuracy
d01spc cannot guarantee, but in practice usually achieves, the following accuracy:
where and epsabs and epsrel are user-specified absolute and relative error tolerances. Moreover it returns the quantity abserr which, in normal circumstances, satisfies
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
d01spc is not threaded in any implementation.
9Further Comments
The time taken by d01spc depends on the integrand and the accuracy required.
If the function fails with an error exit other than NE_INT_ARG_LT, NE_BAD_PARAM, NE_REAL_ARG_LE, NE_2_REAL_ARG_LE or NE_ALLOC_FAIL then you may wish to examine the contents of the structure qp. These contain the end-points of the sub-intervals used by d01spc along with the integral contributions and error estimates over these sub-intervals.
Specifically, , let denote the approximation to the value of the integral over the sub-interval in the partition of and be the corresponding absolute error estimate.
Then, and .
The value of is returned in , and the values , , and are stored in the structure qp as