|
IDL Analyst Reference Guide: Quadrature |
|
This version of the IMSL_INTFCN function integrates smooth functions using a nonadaptive rule.
| Note The SMOOTH keyword must be supplied to use this integration method. |
Result = IMSL_INTFCN(f, a, b, [, /SMOOTH] [, /DOUBLE] [, ERR_ABS=value] [, ERR_EST=variable] [, ERR_REL=value] )
The value of:

is returned. If no value can be computed, the floating-point value NaN (Not a Number) is returned.
A scalar string specifying the name of a user-supplied function to be integrated. The function f accepts one scalar parameter and returns a single scalar of the same type.
A scalar expression specifying the lower limit of integration.
A scalar expression specifying the upper limit of integration.
Because this integration method is nonadaptive, the global IMSL_INTFCN keywords listed in the main section do not apply. A complete list of the available keywords is given below. This method requires the use of keyword SMOOTH.
Set this keyword to use a nonadaptive rule to compute the integral.
Set this keyword to perform computations using double precision.
Set this keyword to a value specifying the accuracy desired. Default: ERR_ABS=SQRT(e), where e is the machine precision
Set this keyword equal to a named variable that will contain an estimate of the absolute value of the error.
Set this keyword to a value specifying the relative accuracy desired. Default: ERR_REL=SQRT(e), where e is the machine precision
This method is designed to integrate smooth functions. It implements a nonadaptive quadrature procedure based on nested Paterson rules of order 10, 21, 43, and 87. These rules are positive quadrature rules with degree of accuracy 19, 31, 64, and 130, respectively. This method applies these rules successively, estimating the error until either the error estimate satisfies the user-supplied constraints or the last rule is applied.
This method is not very robust, but for certain smooth functions, it can be efficient. This method is based on the subroutine QNG by Piessens et al. (1983). If this method is used, the function should be coded to protect endpoint singularities if they exist.
The value of:

is computed.
.RUN
; Define the function to integrate.
FUNCTION f, x
RETURN, x * EXP(x)
END
ans = IMSL_INTFCN('f', 0, 2, /Smooth)
; Call IMSL_INTFCN with keyword Smooth set.
PM, 'Computed Answer:', ans
Computed Answer:
8.38906
exact = EXP(2) + 1
PM, 'Exact - Computed:', exact - ans
Exact - Computed:
9.53674e-07
See Errors.
IDL Online Help (March 06, 2007)