These subroutines approximate the integral of a real valued function
specified in tabular form, (xi,
yi) for i = 1,
n. For more than four points, an error estimate is returned
along with the resulting value.
x, y, xyint, eest | Subroutine |
Short-precision real | SPTNQ |
Long-precision real | DPTNQ |
Fortran | CALL SPTNQ | DPTNQ (x, y, n, xyint, eest) |
C and C++ | sptnq | dptnq (x, y, n, xyint, eest); |
PL/I | CALL SPTNQ | DPTNQ (x, y, n, xyint, eest); |
If n < 5, it is undefined and is set to 0.
If n >= 5, it is an estimate, eest, of the error in the integral, where xyint+eest tends to give a better approximation to the integral than xyint. For details, see references [26] and [61].
Returned as: a number of the data type indicated in Table 160.
The integral is approximated for a real valued function specified in tabular form, (xi, yi) for i = 1, n, where xi are distinct and sorted into ascending or descending order, and n >= 2. If yi = f(xi) for i = 1, n, then on output, xyint is an approximation to the integral of the following form:
The algorithm used by this subroutine is based on the number of data points used in the computation, where:
For n >= 5, an estimate of the error eest is returned. For the method of Gill and Miller, it is shown that adding the estimate of the error eest to the result xyint often gives a better approximation to the integral than the result xyint by itself. For n < 5, an estimate of the error is not returned. In this case, a value of 0 is returned for eest. See references [61] and [26].
None
n < 2
This example shows the result of an integration, where the abscissas in X are sorted into ascending order.
X Y N XYINT EEST | | | | | CALL SPTNQ( X , Y , 10 , XYINT , EEST ) X = (0.0, 0.4, 1.0, 1.5, 2.1, 2.6, 3.0, 3.4, 3.9, 4.3) Y = (1.0, 2.0, 3.0, 4.0, 5.0, 4.5, 4.0, 3.0, 3.5, 3.3)
XYINT = 15.137 EEST = -0.003
This example shows the result of an integration, where the abscissas in X are sorted into descending order.
X Y N XYINT EEST | | | | | CALL SPTNQ( X , Y , 10 , XYINT , EEST ) X = (4.3, 3.9, 3.4, 3.0, 2.6, 2.1, 1.5, 1.0, 0.4, 0.0) Y = (3.3, 3.5, 3.0, 4.0, 4.5, 5.0, 4.0, 3.0, 2.0, 1.0)
XYINT = -15.137 EEST = 0.003