INT_2D

The INT_2D function computes the double integral of a bivariate function using iterated Gaussian quadrature. The algorithm's transformation data is provided in tabulated form with 15 decimal accuracy.

This routine is written in the IDL language. Its source code can be found in the file int_2d.pro in the lib subdirectory of the IDL distribution.

Calling Sequence

Result = INT_2D( Fxy, AB_Limits, PQ_Limits, Pts )

Arguments

Fxy

A scalar string specifying the name of a user-supplied IDL function that defines the bivariate function to be integrated. The function must accept X and Y and return a scalar result.

For example, if we wish to integrate the following function:

We define a function FXY to express this relationship in the IDL language:

FUNCTION fxy, X, Y

  RETURN, EXP(-X^2. -Y^2.)

END

AB_Limits

A two-element vector containing the lower (A) and upper (B) limits of integration with respect to the variable x .

PQ_Limits

A scalar string specifying the name of a user-supplied IDL function that defines the lower (P( x )) and upper (Q( x )) limits of integration with respect to the variable y . The function must accept x and return a two-element vector result.

For example, we might write the following IDL function to represent the limits of integration with respect to y :

FUNCTION PQ_limits, X

  RETURN, [-SQRT(16.0 - X^2), SQRT(16.0 - X^2)]

END

Pts

The number of transformation points used in the computation. Possible values are: 6, 10, 20, 48, or 96.

Keywords

DOUBLE

Set this keyword to force the computation to be done in double-precision arithmetic.

ORDER

A scalar value of either 0 or 1. If set to 0, the integral is computed using a dx-dy order of integration. If set to 1, the integral is computed using a dx-dy order of integration.

Example

Compute the double integral of the bivariate function.

function PQ_Limits, x

    return, [0.0, x^2]

end ; Define the limits of integration for y as a function of x.

AB_Limits = [0.0, 2.0] ; Define limits of integration for x.

Using the function and limits defined above, integrate with 48 and 96 point formulas using a dy-dx order of integration and double-precision arithmetic:

PRINT, INT_2D('Fxy', AB_Limits, 'PQ_Limits', 48, /DOUBLE)

PRINT, INT_2D('Fxy', AB_Limits, 'PQ_Limits', 96, /DOUBLE)

INT_2D with 48 transformation points yields: 0.055142668

INT_2D with 96transformation points yields: 0.055142668

 

Compute the double integral of the bivariate function.

function PQ_Limits, y

    return, [sqrt(y), 2.0]

end ; Define the limits of integration for y as a function of x.

AB_Limits = [0.0, 4.0] ; Define limits of integration for x.

Using the function and limits defined above, integrate with 48 and 96 point formulas using a dy-dx order of integration and double-precision arithmetic:

PRINT, INT_2D('Fxy', AB_Limits, 'PQ_Limits', 48, /DOUBLE, /ORDER)

PRINT, INT_2D('Fxy', AB_Limits, 'PQ_Limits', 96, /DOUBLE, ORDER)

INT_2D with 48 transformation points yields: 0.055142678

INT_2D with 96 transformation points yields: 0.055142668

The exact solution (7 decimal accuracy) is: 0.055142668

See Also

INT_3D , INT_TABULATED , QROMB , QROMO , QSIMP