IMSL_INTFCN:
Smooth Functions Using Nonadaptive Rule

Syntax | Return Value | Arguments | Keywords | Discussion | Example | Errors

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.

Syntax

Result = IMSL_INTFCN(f, a, b, [, /SMOOTH] [, /DOUBLE] [, ERR_ABS=value] [, ERR_EST=variable] [, ERR_REL=value] )

Return Value

The value of:

IMSL_INTFCN_Smooth_Functions_Using_Nonadaptive_Rule-34.jpg

is returned. If no value can be computed, the floating-point value NaN (Not a Number) is returned.

Arguments

f

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

A scalar expression specifying the lower limit of integration.

b

A scalar expression specifying the upper limit of integration.

Keywords

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.

SMOOTH

Set this keyword to use a nonadaptive rule to compute the integral.

DOUBLE

Set this keyword to perform computations using double precision.

ERR_ABS

Set this keyword to a value specifying the accuracy desired. Default: ERR_ABS=SQRT(ε), where ε is the machine precision

ERR_EST

Set this keyword equal to a named variable that will contain an estimate of the absolute value of the error.

ERR_REL

Set this keyword to a value specifying the relative accuracy desired. Default: ERR_REL=SQRT(ε), where ε is the machine precision

Discussion

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.

Example

The value of:

IMSL_INTFCN_Smooth_Functions_Using_Nonadaptive_Rule-35.jpg

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  

Errors

See Errors.