IMSL_INTFCN:
Functions with Singular Points Given

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

This version of the IMSL_INTFCN function integrates functions with singularity points given.

Note
The SING_PTS keyword must be supplied to use this integration method.

Syntax

Result = IMSL_INTFCN(f, a, b, SING_PTS=points [, SING_PTS=vector] )

Return Value

The value of:

IMSL_INTFCN_Functions_with_Singular_Points_Given-16.jpg

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.

Keywords

In addition to the global IMSL_INTFCN keywords listed in the main section under Keywords, the following keywords are available:

SING_PTS

Set this keyword equal to a vector of abcissa values for the singularities. The values should be interior to the interval [a, b].

Discussion

This method is a special-purpose integrator that uses a globally adaptive scheme to reduce the absolute error. It subdivides the interval [a, b] into N+1 user-supplied subintervals, where N is the number of singular points, and uses a 21-point Gauss-Kronrod rule to estimate the integral over each subinterval. The error for each subinterval is estimated by comparison with the 10-point Gauss quadrature rule. The subinterval with the largest estimated error is then bisected, and the same procedure is applied to both halves. The bisection process is continued until either the error criterion is satisfied, the roundoff error is detected, the subintervals become too small, or the maximum number of subintervals allowed is reached. This method uses an extrapolation procedure known as the ε-algorithm. This method is based on the subroutine QAGP by Piessens et al. (1983).

Example

The value of:

IMSL_INTFCN_Functions_with_Singular_Points_Given-17.jpg

is computed. The values of the actual and estimated error are machine dependent. Note that this subfunction never evaluates the user-supplied function at the user-supplied breakpoints.

.RUN 
; Define the function to be integrated.  
FUNCTION f, x 
   RETURN, x^3 * ALOG(ABS((x^2 - 1) * $ 
   (x^ 2 - 2))) 
END 
 
ans = IMSL_INTFCN('f', 0, 3, $ 
Sing_Pts = [1, SQRT(2)], N_Evals = nevals) 
; Call IMSL_INTFCN using keyword Sing_Pts to specify  
; the singular points. 
PM, 'Computed Answer:', ans 
; Output the results. 
Computed Answer: 
        52.7408 
exact = 61 * ALOG(2) + (77/4.) * ALOG(7) - 27 
PM, 'Exact - Computed:', exact - ans 
Exact - Computed: 
   -2.67029e-05 
PM, 'Number of Function Evaluations:', nevals 
Number of Function Evaluations: 
           819 

Errors

See Errors.