Welcome to the Harris Geospatial product documentation center. Here you will find reference guides, help documents, and product libraries.



The QSIMP function performs numerical integration of a function over the closed interval [A, B] using Simpson’s rule.


To integrate the SIMPSON function (listed above) over the interval [0, π/2] and print the result:

; Define lower limit of integration:
A = 0.0
; Define upper limit of integration:
B = !PI/2.0
PRINT, QSIMP('simpson', A, B)

IDL prints:


The exact solution can be found using the integration-by-parts formula:

FB = 4.*B*(B^2-7.)*SIN(B) - (B^4-14.*B^2+28.)*COS(B)
FA = 4.*A*(A^2-7.)*SIN(A) - (A^4-14.*A^2+28.)*COS(A)
exact = FB - FA
PRINT, exact

IDL prints:



Result = QSIMP( Func, A, B [, /DOUBLE] [, EPS=value] [, JMAX=value] )

Return Value

The result will have the same structure as the smaller of A and B, and the resulting type will be single- or double-precision floating, depending on the input types.



A scalar string specifying the name of a user-supplied IDL function to be integrated. This function must accept a single scalar argument X and return a scalar result. It must be defined over the closed interval [A, B].

For example, if we wish to integrate the fourth-order polynomial

y = (x4 - 2x2) sin(x)

we define a function SIMPSON to express this relationship in the IDL language:

FUNCTION simpson, X
   RETURN, (X^4 - 2.0 * X^2) * SIN(X)

Note: If QSIMP is complex then only the real part is used for the computation.


The lower limit of the integration. A can be either a scalar or an array.


The upper limit of the integration. B can be either a scalar or an array.

Note: If arrays are specified for A and B, then QSIMP integrates the user-supplied function over the interval [Ai, Bi] for each i. If either A or B is a scalar and the other an array, the scalar is paired with each array element in turn.



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


The desired fractional accuracy. For single-precision calculations, the default value is 1.0 x 10-6. For double-precision calculations, the default value is 1.0 x 10-12.


2(JMAX - 1) is the maximum allowed number of steps. If not specified, a default of 20 is used.

Version History



Resources and References

QSIMP is based on the routine qsimp described in section 4.2 of Numerical Recipes in C: The Art of Scientific Computing (Second Edition), published by Cambridge University Press, and is used by permission.

See Also


© 2017 Exelis Visual Information Solutions, Inc. |  Legal
My Account    |    Buy    |    Contact Us