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

>  Docs Center  >  IDL Reference  >  Advanced Math and Stats  >  IMSL_INTFCN Functions Containing a Sine or Cosine Factor

### IMSL_INTFCN Functions Containing a Sine or Cosine Factor

IMSL_INTFCN: Functions Containing a Sine or Cosine Factor

This version of the IMSL_INTFCN function integrates functions containing a sine or a cosine factor.

 Note The Omega argument and one of the SINE, or COSINE keywords must be supplied to use this integration method.

## Syntax

Result = IMSL_INTFCN(f, a, b, Omega
, /SINE | /COSINE [, MAX_MOMENTS=value])

## Return Value

The value of:

where the weight function w (wx) is defined by the keywords below, 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.

#### Omega

A scalar expression specifying the frequency of the trigonometric weighting function.

## Keywords

In addition to the global IMSL_INTFCN keywords listed in the main section under Keywords, the following keywords may be specified:

#### SINE

Set this keyword to use sin (wx) for the integration weight function. If SINE is supplied, COSINE must not be present.

#### COSINE

Set this keyword to use cos (wx) for the integration weight function. IF COSINE is supplied, SINE must not be present.

#### MAX_MOMENTS

Set this keyword equal to a scalar expression specifying an upper bound on the number of Chebyshev moments that can be stored. Increasing (decreasing) this number may increase (decrease) execution speed and space used. Default: MAX_MOMENTS = 21

## Discussion

This method is a special-purpose integrator that uses a globally adaptive scheme to reduce the absolute error. It computes integrals whose integrands have the special form w (x) f (x), where w (x) is either cos (wx) or sin (wx). Depending on the length of the subinterval in relation to the size of w, either a modified Clenshaw-Curtis procedure or a Gauss-Kronrod 7/15 rule is employed to approximate the integral on a subinterval. This method is based on the subroutine QAWO 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. The exact answer is:

`.RUN  ; Define the function to be integrated.  FUNCTION f, x     RETURN, x^2  END    ans = IMSL_INTFCN(';f', 0, 1, 3 * !Pi, /Sine)  ; Call IMSL_INTFCN with Sine set and value for method   ; parameter omega.  PM, ';Computed Answer:', ans  ; Output the results.  Computed Answer:         0.101325  exact = ((3 * !Pi)^2 - 2)/((3 * !pi)^3) - 2/(3 * !Pi)^3  PM, ';Exact - Computed:', exact - ans  Exact - Computed:         0.00000  `

## Errors

See Errors.

© 2018 Harris Geospatial Solutions, Inc. |  Legal