This version of the IMSL_INTFCN function integrates smooth functions using a nonadaptive rule. To use this integrations, supply the SMOOTH keyword.

This routine requires an IDL Advanced Math and Stats license. For more information, contact your sales or technical support representative.

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:

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

IDL prints:

Computed Answer:
  8.38906
exact = EXP(2) + 1
 
PM, 'Exact - Computed:', exact - ans

IDL prints:

Exact - Computed:
  9.53674e-07

Errors


See IMSL_INTFCN Errors.

Syntax


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

Return Value


The value of:

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 argument 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 do not apply. Available keywords are below. This method requires the use of keyword SMOOTH.

SMOOTH (optional)

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

DOUBLE (optional)

Set this keyword to perform computations using double precision.

ERR_ABS (optional)

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

ERR_EST (optional)

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

ERR_REL (optional)

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

Version History


6.4

Introduced

See Also


IMSL_INTFCN