E01BHF (PDF version)
E01 Chapter Contents
E01 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

E01BHF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

E01BHF evaluates the definite integral of a piecewise cubic Hermite interpolant over the interval a,b.

2  Specification

SUBROUTINE E01BHF ( N, X, F, D, A, B, PINT, IFAIL)
INTEGER  N, IFAIL
REAL (KIND=nag_wp)  X(N), F(N), D(N), A, B, PINT

3  Description

E01BHF evaluates the definite integral of a piecewise cubic Hermite interpolant, as computed by E01BEF, over the interval a,b.
If either a or b lies outside the interval from X1 to XN computation of the integral involves extrapolation and a warning is returned.
The routine is derived from routine PCHIA in Fritsch (1982).

4  References

Fritsch F N (1982) PCHIP final specifications Report UCID-30194 Lawrence Livermore National Laboratory

5  Parameters

1:     N – INTEGERInput
2:     X(N) – REAL (KIND=nag_wp) arrayInput
3:     F(N) – REAL (KIND=nag_wp) arrayInput
4:     D(N) – REAL (KIND=nag_wp) arrayInput
On entry: N, X, F and D must be unchanged from the previous call of E01BEF.
5:     A – REAL (KIND=nag_wp)Input
6:     B – REAL (KIND=nag_wp)Input
On entry: the interval a,b over which integration is to be performed.
7:     PINT – REAL (KIND=nag_wp)Output
On exit: the value of the definite integral of the interpolant over the interval a,b.
8:     IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of IFAIL on exit.
On exit: IFAIL=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry IFAIL=0 or -1, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
IFAIL=1
On entry,N<2.
IFAIL=2
The values of Xr, for r=1,2,,N, are not in strictly increasing order.
IFAIL=3
On entry, at least one of A or B lies outside the interval [X1,XN], and extrapolation was performed to compute the integral. The value returned is therefore unreliable.

7  Accuracy

The computational error in the value returned for PINT should be negligible in most practical situations.

8  Further Comments

The time taken by E01BHF is approximately proportional to the number of data points included within the interval a,b.

9  Example

This example reads in values of N, X, F and D. It then reads in pairs of values for A and B, and evaluates the definite integral of the interpolant over the interval A,B until end-of-file is reached.

9.1  Program Text

Program Text (e01bhfe.f90)

9.2  Program Data

Program Data (e01bhfe.d)

9.3  Program Results

Program Results (e01bhfe.r)


E01BHF (PDF version)
E01 Chapter Contents
E01 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012