naginterfaces.library.quad.dim1_​fin_​well

naginterfaces.library.quad.dim1_fin_well(a, b, epsr, f, nlimit, data=None)[source]

dim1_fin_well computes a definite integral over a finite range to a specified relative accuracy using a method described by Patterson.

For full information please refer to the NAG Library document for d01ah

https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/d01/d01ahf.html

Parameters
afloat

, the lower limit of integration.

bfloat

, the upper limit of integration. It is not necessary that .

epsrfloat

The relative accuracy required.

fcallable retval = f(x, data=None)

must return the value of the integrand at a given point.

Parameters
xfloat

The point at which the integrand must be evaluated.

dataarbitrary, optional, modifiable in place

User-communication data for callback functions.

Returns
retvalfloat

The value of the integrand at .

nlimitint

A limit to the number of function evaluations. If , the function uses a default limit of .

dataarbitrary, optional

User-communication data for callback functions.

Returns
dinfloat

The value of the definite interval.

nptsint

The number of function evaluations used in the calculation of the integral.

relerrfloat

A rough estimate of the relative error achieved.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

Warns
NagAlgorithmicWarning
(errno )

Integral has failed to converge to requested accuracy.

(errno )

Too many unsuccessful levels of subdivision.

Notes

No equivalent traditional C interface for this routine exists in the NAG Library.

dim1_fin_well computes a definite integral of the form

The method uses as its basis a family of interlacing high precision rules (see Patterson (1968)) using , , , , , , and nodes. Initially the family is applied in sequence to the integrand. When two successive rules differ relatively by less than the required relative accuracy, the last rule used is taken as the value of the integral and the operation is regarded as successful. If all rules in the family have been applied unsuccessfully, subdivision is invoked. The subdivision strategy is as follows. The interval under scrutiny is divided into two sub-intervals (not always equal). The basic family is then applied to the first sub-interval. If the required accuracy is not obtained, the interval is stored for future examination (see = 2) and the second sub-interval is examined. Should the basic family again be unsuccessful, then the sub-interval is further subdivided and the whole process repeated. Successful integrations are accumulated as the partial value of the integral. When all possible successful integrations have been completed, those previously unsuccessful sub-intervals placed in store are examined.

A large number of refinements are incorporated to improve the performance. Some of these are:

  1. The rate of convergence of the basic family is monitored and used to make a decision to abort and subdivide before the full sequence has been applied.

  2. The -algorithm is applied to the basic results in an attempt to increase the convergence rate. See Wynn (1956).

  3. An attempt is made to detect sharp end point peaks and singularities in each sub-interval and to apply appropriate transformations to smooth the integrand. This consideration is also used to select interval sizes in the subdivision process.

  4. The relative accuracy sought in each sub-interval is adjusted in accordance with its likely contribution to the total integral.

  5. Random transformations of the integrand are applied to improve reliability in some instances.

References

Patterson, T N L, 1968, The Optimum addition of points to quadrature formulae, Math. Comput. (22), 847–856

Wynn, P, 1956, On a device for computing the transformation, Math. Tables Aids Comput. (10), 91–96