IMSL_INTFCN:
Computation of Fourier Sine or Cosine Transforms

Syntax | Return Value | Arguments | Keywords | Discussion | Example | Errors

This version of the IMSL_INTFCN function computes Fourier sine or cosine transforms.

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, Omega, /SINE | /COSINE [, MAX_MOMENTS=value] [, N_CYCLES=variable])

Return Value

The value of:

IMSL_INTFCN_Computation_of_Fourier_Sine_or_Cosine_Transforms-29.jpg

where the weight function w x) 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.

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 (ωx) for the integration weight function. If SINE is supplied, COSINE must not be present.

COSINE

Set this keyword to use cos (ωx) 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

N_CYCLES

Set this keyword equal to a named variable that will contain the number of cycles.

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 (ωx) or sin (ωx). The integration interval is always semi-infinite of the form [ainfinity]. This method is based on the subroutine QAWF 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:

IMSL_INTFCN_Computation_of_Fourier_Sine_or_Cosine_Transforms-30.jpg

is computed. Notice that the function is coded to protect for the singularity at zero.

.RUN 
; Define the function to be integrated. 
FUNCTION f, x 
   IF (x EQ 0) THEN RETURN, x $ 
      ELSE RETURN, 1/SQRT(x) 
END 
 
ans = IMSL_INTFCN('f', 0, !Pi/2, /Cosine) 
; Call IMSL_INTFCN with keyword Cosine set and a value for  
; the method specific parameter omega. 
PM, 'Computed Answer:', ans 
; Output the results. 
Computed Answer: 
       1.00000 
exact = 1.0 
   PM, 'Exact - Computed:', exact - ans 
Exact - Computed: 
       -1.19209e-007 

Errors

See Errors.