IMSL_INTFCN:
Two-dimensional Iterated Integrals
Syntax | Return Value | Arguments | Keywords | Discussion | Example | Errors
This version of the IMSL_INTFCN function integrates two-dimensional iterated integrals.
Note
The TWO_DIMENSIONAL keyword must be supplied to use this integration method.
Syntax
Result = IMSL_INTFCN(f, a, b, g, h, /TWO_DIMENSIONAL)
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 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.
g
Scalar string specifying the name of a user-supplied IDL Advanced Math and Stats function used to evaluate the lower limit of the inner integral. Function g accepts one scalar parameter and returns a single scalar of the same type.
h
Scalar string specifying the name of a user-supplied IDL Advanced Math and Stats function used to evaluate the upper limit of the inner integral. Function h accepts one scalar parameter and returns a single scalar of the same type.
Keywords
In addition to the global IMSL_INTFCN keywords listed in the main section under Keywords, the following keyword must be specified:
TWO_DIMENSIONAL
Set this keyword to integrate a two-dimensional iterated integral.
Discussion
This method approximates the following two-dimensional iterated integral:

The lower-numbered rules are used for less smooth integrands, while the higher-order rules are more efficient for smooth (oscillatory) integrands.
If this method is used, the function should be coded to protect endpoint singularities if they exist.
Example
This example computes the value of the integral:

.RUN ; Define the function to be integrated. FUNCTION f, x, y RETURN, SIN(x + y) END .RUN ; Define the function for the lower limit of the inner integral. FUNCTION g, x RETURN, x END .RUN ; Define the function for the upper limit of the inner integral. FUNCTION h, x RETURN, 2 * x END ans = IMSL_INTFCN('f',0,1,'g','h',/Two_Dimensional) ; Call IMSL_INTFCN with keyword Two_Dimensional set and the names ; of the functions defining the limits of the inner integral. PM, 'Computed Answer:', ans Computed Answer: 0.407609 exact = -SIN(3)/3 + SIN(2)/2 PM, 'Exact - Computed:', exact - ans Exact - Computed: -5.96046e-08
Errors
See Errors.