next up previous index
Next: D110 Gaussian Quadrature Up: CERNLIB Previous: D107 N-Point Gaussian

D108 Trapezoidal Rule Integration with an Estimated Error

Routine ID: D108
Author(s): K.S. KölbigLibrary: MATHLIB
Submitter: Submitted: 01.03.1968
Language: FortranRevised:

Let a function f(x) be given by its values at certain discrete points xν(ν=1,2,...,n) . Let the function values yν be accompanied by an estimated standard deviation εν (square root of the variance). Subroutine subprogram TRAPER then approximates the integral

I = ∫ABf(x)dx ∑νwνyν

by a linear combination of the yν using the trapezoidal rule. It calculates the standard deviation σ of I by

σ = νwν2εν2.

The function values f(A) and f(B) are calculated by linear interpolation.

Structure:

SUBROUTINE subprogram
User Entry Names: TRAPER

Usage:

    CALL TRAPER(X,Y,E,N,A,B,RE,SD)
X,Y,E
( REAL) Arrays of length ≥n containing xν,yνν , respectively.
N
( INTEGER) Number of function values
A,B
( REAL) Limits of integration.
RE
( REAL) On exit, RE contains an approximate value of the integral I.
SD
( REAL) On exit, SD contains an approximate value of the standard deviation σ .
If no εν are given, the array E should be filled with zeros.

Restrictions:

Although there are no restrictions on A and B ( B may be less than A), care must be taken if one or both of them is either smaller than X(1) or bigger than X(N). In these cases f(A) or f(B) are extrapolated linearly from Y(1) and Y(2) or Y(N-1) and Y(N) respectively, which may lead to unreasonable results. If A = B or N < 2 , RE and SD will be set to zero. It is assumed that all the xν are distinct. No test is made for this.

Notes:

This program should only be used for the problem described above. For general-purpose numerical integration to a preassigned accuracy use GAUSS (D103).

D110



next up previous index
Next: D110 Gaussian Quadrature Up: CERNLIB Previous: D107 N-Point Gaussian


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995