## QROMO

The QROMO function evaluates the integral of a function over the open interval ( A, B ) using a modified Romberg's method.

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

### Calling Sequence

Result = QROMO( Func, A [ , B ])

### Arguments

#### Func

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 open interval ( A, B ).

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

y = 1 / x 4

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

FUNCTION hyper, X

RETURN, 1.0 / X^4

END

#### A

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

#### B

The upper limit of the integration. B can be either a scalar or an array. If the MIDEXP keyword is specified, B is assumed to be infinite, and should not be supplied by the user.

Note: If arrays are specified for A and B , then QROMO integrates the user-supplied function over the interval [ A i , B i ] 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.

### Keywords

#### DOUBLE

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

#### EPS

The fractional accuracy desired, as determined by the extrapolation error estimate. For single-precision calculations, the default value is 1.0  ¥  10 -6 . For double-precision calculations, the default value is 1.0  ¥  10 -12 .

#### JMAX

Set to specify the maximum allowed number of mid quadrature points to be 3 (JMAX - 1) . The default value is 14.

#### K

Integration is performed by Romberg's method of order 2K. If not specified, the default is K=5.

#### MIDEXP

Use the ``` midexp()``` function (see Numerical Recipes , section 4.4) as the integrating function. If the MIDEXP keyword is specified, argument B is assumed to be infinite, and should not be supplied by the user.

#### MIDINF

Use the ``` midinf()``` function (see Numerical Recipes , section 4.4) as the integrating function.

#### MIDPNT

Use the ``` midpnt()``` function (see Numerical Recipes , section 4.4) as the integrating function. This is the default if no other integrating function keyword is specified.

#### MIDSQL

Use the ``` midsql()``` function (see Numerical Recipes , section 4.4) as the integrating function.

#### MIDSQU

Use the ``` midsqu()``` function (see Numerical Recipes , section 4.4) as the integrating function.

### Example

To integrate the HYPER function (listed above) over the open interval (2, · ) and print the result:

PRINT, QROMO('hyper', 2.0, /MIDEXP)

IDL prints:

0.0412050

CAUTION: When using the /MIDEXP keyword, the upper integration limit is assumed to be infinity and is not supplied.