PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_quad_1d_gen_vec_multi_rcomm (d01ra)
Purpose
nag_quad_1d_gen_vec_multi_rcomm (d01ra) is a general purpose adaptive integrator which calculates an approximation to a vector of definite integrals
over a finite range
, given the vector of integrands
.
If the same subdivisions of the range are equally good for functions and , because and have common areas of the range where they vary slowly and where they vary quickly, then we say that and are ‘similar’. nag_quad_1d_gen_vec_multi_rcomm (d01ra) is particularly effective for the integration of a vector of similar functions.
Syntax
[
irevcm,
sid,
needi,
x,
nx,
dinest,
errest,
icom,
com,
ifail] = d01ra(
irevcm,
a,
b,
needi,
x,
nx,
fm,
dinest,
errest,
iopts,
opts,
icom,
com, 'ni',
ni, 'lenx',
lenx)
[
irevcm,
sid,
needi,
x,
nx,
dinest,
errest,
icom,
com,
ifail] = nag_quad_1d_gen_vec_multi_rcomm(
irevcm,
a,
b,
needi,
x,
nx,
fm,
dinest,
errest,
iopts,
opts,
icom,
com, 'ni',
ni, 'lenx',
lenx)
Description
nag_quad_1d_gen_vec_multi_rcomm (d01ra) is an extension to various QUADPACK routines, including QAG, QAGS and QAGP. The extensions made allow multiple integrands to be evaluated simultaneously, using a vectorized interface and reverse communication.
The quadrature scheme employed by
nag_quad_1d_gen_vec_multi_rcomm (d01ra) can be chosen by you. Six Gauss–Kronrod schemes are available. The algorithm incorporates a global acceptance criterion (as defined by
Malcolm and Simpson (1976)), optionally together with the ε-algorithm (see
Wynn (1956)) to perform extrapolation. The local error estimation is described in
Piessens et al. (1983).
nag_quad_1d_gen_vec_multi_rcomm (d01ra) is the integration function in the suite of functions
nag_quad_1d_gen_vec_multi_rcomm (d01ra) and
nag_quad_1d_gen_vec_multi_dimreq (d01rc). It also uses optional parameters, which can be set and queried using the functions
nag_quad_opt_set (d01zk) and
nag_quad_opt_get (d01zl) respectively. The options available are described in
Optional Parameters.
First, the option arrays
iopts and
opts must be initialized using
nag_quad_opt_set (d01zk). Thereafter any required options must be set before calling
nag_quad_1d_gen_vec_multi_rcomm (d01ra), or the function
nag_quad_1d_gen_vec_multi_dimreq (d01rc).
A typical usage of this suite of functions is (in pseudo-code for clarity),
Setup phase
iopts = zeros(100, 1, nag_int_name);
opts = zeros(100, 1);
% initialize option arrays
[iopts, opts, ifail] = d01zk('Initialize = d01ra', iopts, opts);
% set any non-default options required
[iopts, opts, ifail] = d01zk('option = value', iopts, opts);
...
% determine maximum required array lengths
[lenxrq, ldfmrq, sdfmrq, licmin, licmax, lcmin, lcmax, ifail] = ...
d01rc(ni, iopts, opts);
% allocate remaining arrays
needi = zeros(ni, 1, nag_int_name);
com = zeros(lcmax, 1);
icom = zeros(licmax, 1, nag_int_name);
fm = zeros(ldfmrq, sdfmrq);
dinest = zeros(ni, 1);
errest = zeros(ni, 1);
x = zeros(1, lenxrq);
Solve phase
irevcm = nag_int(1);
while irevcm ~= 0
[irevcm, sid, needi, x, nx, dinest, errest, icomm, comm, ifail] = ...
d01ra(irevcm, a, b, needi, x, nx, fm, dinest, errest, ...
iopts, opts, icom, com);
switch irevcm
case 11
Initial solve phase
evaluate fm(1:ni,1:nx)
case(12) Adaptive solve phase
evaluate fm(needi(1:ni)=1,1:nx)
case(0)
Final return
end
Diagnostic phase
[ivalue, rvalue, cvalue, optype, ifail] = d01zl('option', iopts, opts);
During the initial solve phase, the first estimation of the definite integral and error estimate is constructed over the interval
. This will have been divided into
level
segments, where
is the number of
Primary Divisions, and will use any provided break-points if
.
Once a complete integral estimate over
is available, i.e., after all the estimates for the level 1 segments have been evaluated, the function enters the adaptive phase. The estimated errors are tested against the requested tolerances
and
, corresponding to the
Absolute Tolerance and
Relative Tolerance respectively. Should this test fail, and additional subdivision be allowed, a segment is selected for subdivision, and is subsequently replaced by two new segments at the next level of refinement. How this segment is chosen may be altered by setting
Prioritize Error to either favour the segment with the maximum error, or the segment with the lowest level supporting an unacceptable (although potentially non-maximal) error. Up to
subdivisions are allowed if sufficient memory is provided, where
is the value of
Maximum Subdivisions.
Once a sufficient number of error estimates have been constructed for a particular integral, the function may optionally use
Extrapolation to attempt to accelerate convergence. This may significantly lower the amount of work required for a given integration. To minimize the risk of premature convergence from extrapolation, a safeguard
can be set using
Extrapolation Safeguard, and the extrapolated solution will only be considered if
, where
and
are the estimated error directly from the quadrature and from the extrapolation respectively. If extrapolation is successful for the computation of integral
, the extrapolated solution will be returned in
on completion of
nag_quad_1d_gen_vec_multi_rcomm (d01ra). Otherwise the direct solution will be returned in
. This is indicated by the value of
on completion.
References
Malcolm M A and Simpson R B (1976) Local versus global strategies for adaptive quadrature ACM Trans. Math. Software 1 129–146
Piessens R (1973) An algorithm for automatic integration Angew. Inf. 15 399–401
Piessens R, de Doncker–Kapenga E, Überhuber C and Kahaner D (1983) QUADPACK, A Subroutine Package for Automatic Integration Springer–Verlag
Wynn P (1956) On a device for computing the transformation Math. Tables Aids Comput. 10 91–96
Parameters
Note: this function uses
reverse communication. Its use involves an initial entry, intermediate exits and re-entries, and a final exit, as indicated by the argument
irevcm. Between intermediate exits and re-entries,
all arguments other than irevcm, needi and fm must remain unchanged.
Compulsory Input Parameters
- 1:
– int64int32nag_int scalar
-
On initial entry:
.
- Sets up data structures in icom and com and starts a new integration.
Constraint:
on initial entry.
On intermediate re-entry:
irevcm should normally be left unchanged. However, if
irevcm is set to a negative value,
nag_quad_1d_gen_vec_multi_rcomm (d01ra) will terminate, (see
and
above).
- 2:
– double scalar
-
, the lower bound of the domain.
- 3:
– double scalar
-
, the upper bound of the domain.
If
, where
is the
machine precision (see
nag_machine_precision (x02aj)), then
nag_quad_1d_gen_vec_multi_rcomm (d01ra) will return
, for
.
- 4:
– int64int32nag_int array
-
On initial entry: need not be set.
On intermediate re-entry:
may be used to indicate what action you have taken for integral
.
- You have provided the values
in , for .
- You are abandoning the evaluation of integral . The current values of and will be returned on final completion.
Otherwise you have not provided the value .
- 5:
– double array
-
On initial entry: if
,
x need not be set. This is the default behaviour.
If
,
x is used to supply a set of initial ‘break-points’ inside the domain of integration. Specifically,
must contain a break-point
, for
, where
is the number of
Primary Divisions.
Constraint:
if break-points are supplied, , , , for .
- 6:
– int64int32nag_int scalar
-
On initial entry: need not be set.
On intermediate re-entry: must not be changed.
- 7:
– double array
-
The first dimension of the array
fm must be at least
, where
is dependent upon
and the options currently set.
is returned as
ldfmrq from
nag_quad_1d_gen_vec_multi_dimreq (d01rc). If default options are chosen,
, implying
.
The second dimension of the array
fm must be at least
, where
is dependent upon
and the options currently set.
is returned as
sdfmrq from
nag_quad_1d_gen_vec_multi_dimreq (d01rc). If default options are chosen,
.
On initial entry: need not be set.
On intermediate re-entry: if indicated by you must supply the values in , for and .
- 8:
– double array
-
contains the current estimate of the definite integral .
On initial entry: need not be set.
On intermediate re-entry: must not be altered.
- 9:
– double array
-
contains the current error estimate of the definite integral .
On initial entry: need not be set.
On intermediate re-entry: must not be altered.
- 10:
– int64int32nag_int array
- 11:
– double array
-
The arrays
iopts and
opts must not be altered between calls to any of the functions
nag_quad_1d_gen_vec_multi_rcomm (d01ra),
nag_quad_1d_gen_vec_multi_dimreq (d01rc),
nag_quad_opt_set (d01zk) and
nag_quad_opt_get (d01zl).
- 12:
– int64int32nag_int array
-
licom, the dimension of the array, must satisfy the constraint
, where
is dependent upon
ni and the current options set.
is returned as
licmin from
nag_quad_1d_gen_vec_multi_dimreq (d01rc). If the default options are set, then
. Larger values than
are recommended if you anticipate that any integrals will require the domain to be further subdivided..
icom contains details of the integration procedure, including information on the integration of the
integrals over individual segments. This data is stored sequentially in the order that segments are created. For further information see
Details of the Computation.
- 13:
– double array
-
lcom, the dimension of the array, must satisfy the constraint
, where
is dependent upon
ni,
and the current options set.
is returned as
lcmin from
nag_quad_1d_gen_vec_multi_dimreq (d01rc). If default options are set, then
. Larger values are recommended if you anticipate that any integrals will require the domain to be further subdivided.
Given the current options and arguments, the maximum value,
, of
lcom that may be required, is returned as
lcmax from
nag_quad_1d_gen_vec_multi_dimreq (d01rc). If default options are chosen,
.
.
com contains details of the integration procedure, including information on the integration of the
integrals over individual segments. This data is stored sequentially in the order that segments are created. For further information see
Details of the Computation.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the arrays
needi,
dinest,
errest and the first dimension of the array
fm. (An error is raised if these dimensions are not equal.)
, the number of integrands.
- 2:
– int64int32nag_int scalar
-
Default:
the dimension of the array
x.
The dimension of the array
x. currently
will be sufficient for all cases.
Constraint:
, where
is dependent upon the options currently set (see
Optional Parameters).
is returned as
lenxrq from
nag_quad_1d_gen_vec_multi_dimreq (d01rc).
Output Parameters
- 1:
– int64int32nag_int scalar
-
On intermediate exit:
or
.
irevcm requests the integrands
be evaluated for all required
as indicated by
needi, and at all the points
, for
. Abscissae
are provided in
and
must be returned in
.
During the initial solve phase:
- Function values are required to construct the initial estimates of the definite integrals.
If , must be supplied in . This will be the case unless you have abandoned the evaluation of specific integrals on a previous call.
If , you have previously abandoned the evaluation of integral , and hence should not supply the value of .
dinest and
errest contain incomplete information during this phase. As such you should not abandon the evaluation of any integrals during this phase unless you do not require their estimate.
If
irevcm is set to a negative value during this phase,
, for
, will be set to this negative value and
will be returned.
During the adaptive solve phase:
- Function values are required to improve the estimates of the definite integrals.
If , any evaluation of will be discarded, so there is no need to provide them.
If , must be provided in .
If , or , the current error estimate of integral does not require integrand to be evaluated and provided in . Should you choose to, integrand can be evaluated in which case must be set to .
dinest and
errest contain complete information during this phase.
If
irevcm is set to a negative value during this phase
,
or
will be returned and the elements of
needi will reflect the current state of the adaptive process.
On final exit:
.
- Indicates the algorithm has completed.
- 2:
– int64int32nag_int scalar
-
On intermediate exit:
sid identifies a specific set of abscissae,
, returned during the integration process. When a new set of abscissae are generated the value of
sid is incremented by
. Advanced users may store calculations required for an identified set
, and reuse them should
nag_quad_1d_gen_vec_multi_rcomm (d01ra) return the same value of
sid, i.e., the same set of abscissae was used.
- 3:
– int64int32nag_int array
-
On intermediate exit:
indicates what action must be taken for integral
(see
irevcm).
- Do not provide . Any provided values will be ignored.
- The values
must be provided in , for .
- The values are not required, however the error estimate for integral is still above the requested tolerance. If you wish to provide values for the evaluation of integral , set , and supply
in , for .
- The error estimate for integral cannot be improved to below the requested tolerance directly, either because no more new splits may be performed due to exhaustion, or due to the detection of extremely bad integrand behaviour. However, providing the values may still lead to some improvement, and may lead to an acceptable error estimate indirectly using Wynn's epsilon algorithm. If you wish to provide values for the evaluation of integral , set , and supply
in , for .
- The error estimate of integral is below the requested tolerance. If you believe this to be false, if for example the result in is greatly different to what you may expect, you may force the algorithm to re-evaluate this conclusion by including the evaluations of integrand at
, for , and setting . Integral and error estimation will be performed again during the next iteration.
On final exit:
indicates the final state of integral
.
- The error estimate for is below the requested tolerance.
- The error estimate for is below the requested tolerance after extrapolation.
- The error estimate for is above the requested tolerance.
- The error estimate for is above the requested tolerance, and extremely bad behaviour of integral has been detected.
- You prohibited further evaluation of integral .
- 4:
– double array
-
On intermediate exit:
is the abscissa , for , at which the appropriate integrals must be evaluated.
- 5:
– int64int32nag_int scalar
-
On intermediate exit:
, the number of abscissae at which integrands are required.
- 6:
– double array
-
contains the current estimate of the definite integral .
Contains the current estimates of the
ni integrals. If
, this will be the final solution.
- 7:
– double array
-
contains the current error estimate of the definite integral .
Contains the current error estimates for the
ni integrals. If
,
errest contains the final error estimates of the
ni integrals.
- 8:
– int64int32nag_int array
-
- 9:
– double array
-
- 10:
– int64int32nag_int scalar
On final exit:
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Note: nag_quad_1d_gen_vec_multi_rcomm (d01ra) may return useful information for one or more of the following detected errors or 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.
- W
-
At least one error estimate exceeded the requested tolerances.
- W
-
Extremely bad behaviour was detected for at least one integral.
- W
-
Extremely bad behaviour was detected for at least one integral. At least one other integral error estimate was above the requested tolerance.
-
-
irevcm had an illegal value.
-
-
Constraint: .
-
-
On entry,
and at least one supplied break-point in
x is outside of the domain of integration.
-
-
-
-
- W
-
- W
-
-
-
Either the option arrays
iopts and
opts have not been initialized for
nag_quad_1d_gen_vec_multi_rcomm (d01ra), or they have become corrupted.
-
-
On entry, one of
icom and
com has become corrupted.
- W
-
Evaluation of all integrals has been stopped during the initial phase.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
nag_quad_1d_gen_vec_multi_rcomm (d01ra) cannot guarantee, but in practice usually achieves, the following accuracy for each integral
:
where
and
are the error tolerances
Absolute Tolerance and
Relative Tolerance respectively. Moreover, it returns
errest, the entries of which in normal circumstances satisfy,
Further Comments
The time required by nag_quad_1d_gen_vec_multi_rcomm (d01ra) is usually dominated by the time required to evaluate the values of the integrands .
nag_quad_1d_gen_vec_multi_rcomm (d01ra) will be most efficient if any badly behaved integrands provided have irregularities over similar subsections of the domain. For example, evaluation of the integrals,
will be quite efficient, as the irregular behaviour of the first two integrands is at
. On the contrary, the evaluation of the integrals,
will be less efficient, as the two integrands have singularities at opposite ends of the domain, which will result in subdivisions which are only of use to one integrand. In such cases, it will be more efficient to use two sets of calls to
nag_quad_1d_gen_vec_multi_rcomm (d01ra).
nag_quad_1d_gen_vec_multi_rcomm (d01ra) will flag extremely bad behaviour if a sub-interval
with bounds
satisfying
has a local error estimate greater than the requested tolerance for at least one integral. The values
and
can be set through the optional parameters
Absolute Interval Minimum and
Relative Interval Minimum respectively.
Details of the Computation
This section is recommended for expert users only. It describes the contents of the arrays
com and
icom upon exit from
nag_quad_1d_gen_vec_multi_rcomm (d01ra) with
,
,
or
, and provided at least one iteration completed, failure due to insufficient
licom or
lcom.
The arrays
icom and
com contain details of the integration, including various scalars, one-dimensional arrays, and (effectively) two-dimensional arrays. The dimensions of these arrays vary depending on the arguments and options used and the progress of the algorithm. Here we describe some of these details, including how and where they are stored in
icom and
com.
Scalar quantities:
The indices in
icom including the following scalars are available via query only options, see
Diagnostic Options. For example,
is the integer value returned by the option
Index LDI.
|
The leading dimension of the two-dimensional integer arrays stored in icom detailed below.
. |
|
The leading dimension of the two-dimensional real arrays stored in com detailed below.
. |
|
The number of segments that have been subdivided during the adaptive process.
. |
|
The total number of segments formed.
.
. |
|
The reference of the first element of the array stored in com.
. |
|
The reference of the first element of the array stored in com.
. |
|
The reference of the first element of the array stored in icom.
. |
|
The reference of the first element of the array stored in icom.
. |
|
The reference of the first element of the array stored in com.
. |
|
The reference of the first element of the array stored in icom.
. |
One-dimensional arrays:
-
-
.
contains the number of different approximations of integral calculated, for .
Two-dimensional arrays:
-
-
.
contains information about the hierarchy of splitting.
contains the split identifier for segment , for .
contains the parent segment number of segment (i.e., the segment was split to create segment ), for .
and
contain the segment numbers of the two child segments formed from segment , if segment has been split. If segment has not been split, these will be negative.
contains the level at which the segment exists, corresponding to , where is the number of ancestor segments of segment , for . A negative level indicates that segment will not be split further, the level is then given by the absolute value of .
-
-
.
contains the bounds of each segment.
contains the lower bound of segment , for .
contains the upper bound of segment , for .
-
-
.
contains information to indicate whether an estimate of the integral has been obtained over segment , and if so whether this evaluation still contributes to the direct estimate of , for and .
indicates that integral has not been evaluated over segment .
indicates that integral has been evaluated over segment , and that this evaluation contributes to the direct estimate of .
indicates that integral has been evaluated over segment , that this evaluation contributes to the direct estimate of , and that you have requested no further evaluation of this integral at this segment by setting .
indicates that integral has been evaluated over segment , and this evaluation no longer contributes to the direct estimate of .
indicates that integral has been evaluated over segment , that this evaluation contributes to the direct estimate of , and that this segment is too small for any further splitting to be performed. Integral also has a local error estimate over this segment above the requested tolerance. Such segments cause nag_quad_1d_gen_vec_multi_rcomm (d01ra) to return or , indicating extremely bad behaviour.
indicates that integral has been evaluated over segment , that this evaluation contributes to the direct estimate of , and that this segment is too small for any further splitting to be performed. The local error estimate is however below the requested tolerance.
-
-
.
contains the definite integral estimate of the th integral over the th segment, , provided it has been evaluated, for and .
-
-
.
contains the definite integral error estimate of the th integral over the th segment, , provided it has been evaluated, for and .
For each integral
, the direct approximation
of
, and its error estimate
, may be constructed as,
where
is the set of all contributing segments,
.
will have been returned in
, unless extrapolation was successful, as indicated by
.
Similarly,
will have been returned in
unless extrapolation was successful, in which case the error estimate from the extrapolation will have been returned. If for a given integral
one or more contributing segments have unacceptable error estimates, it may be possible to improve the direct approximation by replacing the contributions from these segments with more accurate estimates should these be calculable by some means. Indeed for any segment
, with lower bound
and upper bound
, one may alter the direct approximation
by the following,
The error estimate may be altered similarly.
Example
Open in the MATLAB editor:
d01ra_example
function d01ra_example
fprintf('d01ra example results\n\n');
ni = int64(2);
nx = int64(0);
a = 0;
b = pi;
iopts = zeros(100, 1, 'int64');
opts = zeros(100, 1);
[iopts, opts, ifail] = d01zk('Initialize = d01ra', iopts, opts);
[iopts, opts, ifail] = d01zk('Quadrature Rule = gk41', iopts, opts);
[iopts, opts, ifail] = d01zk('Absolute Tolerance = 1.0e-7', iopts, opts);
[iopts, opts, ifail] = d01zk('Relative Tolerance = 1.0e-7', iopts, opts);
[lenxrq, ldfmrq, sdfmrq, licmin, licmax, lcmin, lcmax, ifail] = ...
d01rc(ni, iopts, opts);
needi = zeros(ni, 1, 'int64');
comm = zeros(lcmax, 1);
icomm = zeros(licmax, 1, 'int64');
fm = zeros(ldfmrq, sdfmrq);
dinest = zeros(ni, 1);
errest = zeros(ni, 1);
x = zeros(1, lenxrq);
irevcm = int64(1);
while irevcm ~= 0
[irevcm, sid, needi, x, nx, dinest, errest, icomm, comm, ifail] = ...
d01ra(irevcm, a, b, needi, x, nx, fm, dinest, errest, ...
iopts, opts, icomm, comm);
switch irevcm
case 11
fm(2, :) = x.*sin(2*x);
fm(1, :) = fm(2, :).*cos(15*x);
fm(2, :) = fm(2, :).*x.*cos(50*x);
case 12
fm(2, :) = x.*sin(2*x);
if needi(1) == 1
fm(1, :) = fm(2, :).*cos(15*x);
end
if needi(2) == 1
fm(2, :) = fm(2, :).*x.*cos(50*x);
end
case 0
end
end
[ivalue, rvalue, cvalue, optype, ifail] = ...
d01zl('Quadrature rule', iopts, opts);
display_option('Quadrature rule',optype,ivalue,rvalue,cvalue);
[ivalue, rvalue, cvalue, optype, ifail] = ...
d01zl('Maximum Subdivisions', iopts, opts);
display_option('Maximum Subdivisions',optype,ivalue,rvalue,cvalue);
[ivalue, rvalue, cvalue, optype, ifail] = ...
d01zl('Extrapolation', iopts, opts);
display_option('Extrapolation',optype,ivalue,rvalue,cvalue);
[ivalue, rvalue, cvalue, optype, ifail] = ...
d01zl('Extrapolation Safeguard', iopts, opts);
display_option('Extrapolation Safeguard',optype,ivalue,rvalue,cvalue);
fprintf('\nIntegral | needi | dinest | errest \n');
for j=1:ni
fprintf('%9d %9d %12.4e %12.4e\n', j, needi(j), dinest(j), errest(j));
end
function [dinest, errest, user] = monit(ni, ns, dinest, errest, fcount, ...
sinfoi, evals, ldi, sinfor, fs, ...
es, ldr, user)
fprintf('\nInformation on splitting and evaluations over subregions.\n');
for k=1:ns
sid = sinfoi(1,k);
parent = sinfoi(2,k);
child1 = sinfoi(3,k);
child2 = sinfoi(4,k);
level = sinfoi(5,k);
lbnd = sinfor(1,k);
ubnd = sinfor(2,k);
fprintf('\nSegment %3d Sid = %3d', k, sid);
fprintf(' Parent = %3d Level = %3d.\n', parent, level);
if (child1>0)
fprintf('Children = (%3d, %3d)\n', child1, child2);
end
fprintf('Bounds (%11.4e, %11.4e)\n', lbnd, ubnd);
for j = 1:ni
if (evals(j,k) ~= 0)
fprintf('Integral %2d approximation %11.4e\n', j, fs(j,k));
fprintf('Integral %2d error estimate %11.4e\n', j, es(j,k));
end
if (evals(j,k) ~= 1)
fprintf('Integral %2d evaluation', j);
fprintf(' has been superseded by descendants.\n');
end
end
end
function display_option(optstr,optype,ivalue,rvalue,cvalue)
switch optype
case 1
fprintf('%30s: %13d\n', optstr, ivalue);
case 2
fprintf('%30s: %13.4e\n', optstr, rvalue);
case 3
fprintf('%30s: %16s\n', optstr, cvalue);
case 4
fprintf('%30s: %3d %16s\n', optstr, ivalue, cvalue);
case 5
fprintf('%30s: %14.4e %16s\n', optstr, rvalue, cvalue);
end
d01ra example results
Quadrature rule: GK41
Maximum Subdivisions: 50
Extrapolation: ON
Extrapolation Safeguard: 1.0000e-12
Integral | needi | dinest | errest
1 0 -2.8431e-02 1.1234e-14
2 0 7.9083e-03 2.6600e-09
Optional Parameters
This section can be skipped if you wish to use the default values for all optional parameters, otherwise, the following is a list of the optional parameters available. A full description of each optional parameter is provided in
Description of the s.
The following optional parameters, see
Diagnostic Options, may be utilized by expert users in conjunction with the information provided in
Details of the Computation.
Description of the Optional Parameters
For each option, we give a summary line, a description of the optional parameter and details of constraints.
The summary line contains:
- the keywords, where the minimum abbreviation of each keyword is underlined;
- a parameter value,
where the letters , and denote options that take character, integer and real values respectively;
- the default value.
The following
symbol represents
various machine constants:
All options accept the value ‘DEFAULT’ in order to return single options to their default states.
Keywords and character values are case insensitive, however they must be separated by at least one space.
Unsetable options will return the appropriate value when calling
nag_quad_opt_get (d01zl). They will have no effect if passed to
nag_quad_opt_set (d01zk).
For
nag_quad_1d_gen_vec_multi_rcomm (d01ra) the maximum length of the argument
cvalue used by
nag_quad_opt_get (d01zl) is
.
Absolute Interval Minimum Default
, the absolute lower limit for a segment to be considered for subdivision. See also
Relative Interval Minimum and
Further Comments.
Constraint: .
Absolute Tolerance Default
, the absolute tolerance required. See also
Relative Tolerance and
Description.
Constraint: .
Default
Activate or deactivate the use of the
algorithm (
Wynn (1956)).
Extrapolation often reduces the number of iterations required to achieve the desired solution, but it can occasionally lead to premature convergence towards an incorrect answer.
- Use extrapolation.
- Disable extrapolation.
Default
. If is the estimated error from the quadrature evaluation alone, and is the error estimate determined using extrapolation, then the extrapolated solution will only be accepted if .
Maximum Subdivisions Default
, the maximum number of subdivisions the algorithm may use in the adaptive phase, forming at most an additional segments.
Primary Divisions Default
, the number of initial segments of the domain . By default the initial segment is the entire domain.
Constraint: .
Primary Division Mode Default
Determines how the initial set of segments will be generated.
- AUTOMATIC
- nag_quad_1d_gen_vec_multi_rcomm (d01ra) will automatically generate segments of equal size covering the interval .
- MANUAL
- nag_quad_1d_gen_vec_multi_rcomm (d01ra) will use the break-points , for , supplied in x on initial entry to generate the initial segments covering . These may be supplied in any order, however it will be more efficient to supply them in ascending (or descending if ) order. Repeated break-points are allowed, although this will generate fewer initial segments.
Note: an absolute bound on the size of an initial segment of is automatically applied in all cases, and will result in fewer initial subdivisions being generated if automatically generated or supplied break-points result in segments smaller than this..
Prioritize Error Default
Indicates how new subdivisions of segments sustaining unacceptable local errors for integrals should be prioritized.
- Segments with lower level with unsatisfactory error estimates will be chosen over segments with greater error on higher levels. This will probably lead to more integrals being improved in earlier iterations of the algorithm, and hence will probably lead to fewer repeated returns (see argument sid), and to more integrals being satisfactorily estimated if computational exhaustion occurs.
- The segment with the worst overall error will be split, regardless of level. This will more rapidly improve the worst integral estimates, although it will probably result in the fewest integrals being improved in earlier iterations, and may hence lead to more repeated returns (see argument sid), and potentially fewer integrals satisfying the requested tolerances if computational exhaustion occurs.
Quadrature Rule Default
The basic quadrature rule to be used during the integration. Currently
Gauss–Kronrod rules are available, all identifiable by the letters GK followed by the number of points required by the Kronrod rule. Higher order rules generally provide higher accuracy with fewer subdivisons. However, for integrands with sharp singularities, lower order rules may be more efficient, particularly if the integrand away from the singularity is well behaved. With higher order rules, you may need to increase the
Absolute Interval Minimum and the
Relative Interval Minimum to maintain numerical difference between the abscissae and the segment bounds.
- GK15
- The Gauss–Kronrod rule based on Gauss points and Kronrod points.
- GK21
- The Gauss–Kronrod rule based on Gauss points and Kronrod points. This is the rule used by
nag_quad_1d_fin_bad_vec (d01at)
- GK31
- The Gauss–Kronrod rule based on Gauss points and Kronrod points.
- GK41
- The Gauss–Kronrod rule based on Gauss points and Kronrod points.
- GK51
- The Gauss–Kronrod rule based on Gauss points and Kronrod points.
- GK61
- The Gauss–Kronrod rule based on Gauss points and Kronrod points. This is the highest order rule, most suitable for highly oscilliatory integrals.
Relative Interval Minimum Default
, the relative factor in the lower limit,
, for a segment to be considered for subdivision. See also
Absolute Interval Minimum and
Further Comments.
Constraint: .
Relative Tolerance Default
, the required relative tolerance. See also
Absolute Tolerance and
Description.
Constraint: .
Note: setting both is possible, although it will most likely result in an excessive amount of computational effort.
Diagnostic Options
These options are provided for expert users who wish to examine and modify the precise details of the computation. They should only be used
after nag_quad_1d_gen_vec_multi_rcomm (d01ra) returns, as opposed to the options listed in
Description of the s which must be used
before the first call to
nag_quad_1d_gen_vec_multi_rcomm (d01ra).
Index LDI query only
, the index of
icom required for obtaining
. See
Details of the Computation.
Index LDR query only
, the index of
icom required for obtaining
. See
Details of the Computation.
Index NSDIV query only
, the index of
icom required for obtaining
. See
Details of the Computation.
Index NSEG query only
, the index of
icom required for obtaining
. See
Details of the Computation.
Index FCP query only
, the index of
icom required for obtaining
. See
Details of the Computation.
Index EVALSP query only
, the index of
icom required for obtaining
. See
Details of the Computation.
Index DSP query only
, the index of
icom required for obtaining
. See
Details of the Computation.
Index ESP query only
, the index of
icom required for obtaining
. See
Details of the Computation.
Index SINFOIP query only
, the index of
icom required for obtaining
. See
Details of the Computation.
Index SINFORP query only
, the index of
icom required for obtaining
. See
Details of the Computation.
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015