﻿ e01be Method
e01be computes a monotonicity-preserving piecewise cubic Hermite interpolant to a set of data points.

# Syntax

C#
```public static void e01be(
int n,
double[] x,
double[] f,
double[] d,
out int ifail
)```
Visual Basic
```Public Shared Sub e01be ( _
n As Integer, _
x As Double(), _
f As Double(), _
d As Double(), _
<OutAttribute> ByRef ifail As Integer _
)```
Visual C++
```public:
static void e01be(
int n,
array<double>^ x,
array<double>^ f,
array<double>^ d,
[OutAttribute] int% ifail
)```
F#
```static member e01be :
n : int *
x : float[] *
f : float[] *
d : float[] *
ifail : int byref -> unit
```

#### Parameters

n
Type: System..::..Int32
On entry: $n$, the number of data points.
Constraint: ${\mathbf{n}}\ge 2$.
x
Type: array<System..::..Double>[]()[][]
An array of size [n]
On entry: ${\mathbf{x}}\left[\mathit{r}-1\right]$ must be set to ${x}_{\mathit{r}}$, the $\mathit{r}$th value of the independent variable (abscissa), for $\mathit{r}=1,2,\dots ,n$.
Constraint: ${\mathbf{x}}\left[r-1\right]<{\mathbf{x}}\left[r\right]$.
f
Type: array<System..::..Double>[]()[][]
An array of size [n]
On entry: ${\mathbf{f}}\left[\mathit{r}-1\right]$ must be set to ${f}_{\mathit{r}}$, the $\mathit{r}$th value of the dependent variable (ordinate), for $\mathit{r}=1,2,\dots ,n$.
d
Type: array<System..::..Double>[]()[][]
An array of size [n]
On exit: estimates of derivatives at the data points. ${\mathbf{d}}\left[r-1\right]$ contains the derivative at ${\mathbf{x}}\left[r-1\right]$.
ifail
Type: System..::..Int32%
On exit: ${\mathbf{ifail}}={0}$ unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

# Description

e01be estimates first derivatives at the set of data points $\left({x}_{\mathit{r}},{f}_{\mathit{r}}\right)$, for $\mathit{r}=1,2,\dots ,n$, which determine a piecewise cubic Hermite interpolant to the data, that preserves monotonicity over ranges where the data points are monotonic. If the data points are only piecewise monotonic, the interpolant will have an extremum at each point where monotonicity switches direction. The estimates of the derivatives are computed by a formula due to Brodlie, which is described in Fritsch and Butland (1984), with suitable changes at the boundary points.
The method is derived from method PCHIM in Fritsch (1982).
Values of the computed interpolant, and of its first derivative and definite integral, can subsequently be computed by calling e01bf (E01BGF not in this release) (E01BHF not in this release), as described in [Further Comments].

# References

Fritsch F N (1982) PCHIP final specifications Report UCID-30194 Lawrence Livermore National Laboratory
Fritsch F N and Butland J (1984) A method for constructing local monotone piecewise cubic interpolants SIAM J. Sci. Statist. Comput. 5 300–304

# Error Indicators and Warnings

Errors or warnings detected by the method:
${\mathbf{ifail}}=1$
 On entry, ${\mathbf{n}}<2$.
${\mathbf{ifail}}=2$
The values of ${\mathbf{x}}\left[\mathit{r}-1\right]$, for $\mathit{r}=1,2,\dots ,{\mathbf{n}}$, are not in strictly increasing order.
${\mathbf{ifail}}=-9000$
An error occured, see message report.
${\mathbf{ifail}}=-8000$
Negative dimension for array $〈\mathit{\text{value}}〉$
${\mathbf{ifail}}=-6000$
Invalid Parameters $〈\mathit{\text{value}}〉$

# Accuracy

The computational errors in the array d should be negligible in most practical situations.

# Parallelism and Performance

None.

The time taken by e01be is approximately proportional to $n$.
The values of the computed interpolant at the points ${\mathbf{px}}\left[\mathit{i}-1\right]$, for $\mathit{i}=1,2,\dots ,{\mathbf{m}}$, may be obtained in the real array pf, of length at least m, by the call: where nx and f are the input parameters to e01be and d is the output parameter from e01be.
The values of the computed interpolant at the points ${\mathbf{px}}\left[\mathit{i}-1\right]$, for $\mathit{i}=1,2,\dots ,{\mathbf{m}}$, together with its first derivatives, may be obtained in the real arrays pf and pd, both of length at least m, by the call: where nxf and d are as described above.