NAG CL Interface
e01bhc (dim1_​monotonic_​intg)

Settings help

CL Name Style:


1 Purpose

e01bhc evaluates the definite integral of a piecewise cubic Hermite interpolant over the interval [a,b] .

2 Specification

#include <nag.h>
void  e01bhc (Integer n, const double x[], const double f[], const double d[], double a, double b, double *integral, NagError *fail)
The function may be called by the names: e01bhc, nag_interp_dim1_monotonic_intg or nag_monotonic_intg.

3 Description

e01bhc evaluates the definite integral of a piecewise cubic Hermite interpolant, as computed by e01bec, over the interval [a,b] .
If either a or b lies outside the interval from x[0] to x[n-1] , computation of the integral involves extrapolation and a warning is returned.
The function 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 Arguments

1: n Integer Input
On entry: n must be unchanged from the previous call of e01bec.
2: x[n] const double Input
3: f[n] const double Input
4: d[n] const double Input
On entry: x, f and d must be unchanged from the previous call of e01bec.
5: a double Input
6: b double Input
On entry: the interval [a,b] over which integration is to be performed.
7: integral double * Output
On exit: the value of the definite integral of the interpolant over the interval [a,b] .
8: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_INT_ARG_LT
On entry, n=value.
Constraint: n2.
NE_NOT_MONOTONIC
On entry, x[r-1] x[r] for r=value : x[r-1] = value, x[r] = value.
The values of x[r] , for r=0,1,,n - 1, are not in strictly increasing order.
NW_INTERVAL_EXTRAPOLATE
On entry, limits a, b must not be outside interval [x[0],x[n-1]] , a=value , b=value , x[0] = value, x[value] = value. Extrapolation was performed to compute the integral. The value returned is, therefore, unreliable.

7 Accuracy

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

8 Parallelism and Performance

e01bhc is not threaded in any implementation.

9 Further Comments

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

10 Example

This example program 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.

10.1 Program Text

Program Text (e01bhce.c)

10.2 Program Data

Program Data (e01bhce.d)

10.3 Program Results

Program Results (e01bhce.r)