In the mathematical field of numerical analysis, monotone cubic interpolation is a variant of cubic interpolation that preserves monotonicity of the data set being interpolated.
Monotonicity is preserved by linear interpolation but not guaranteed by cubic interpolation.
Monotone interpolation can be accomplished using cubic Hermite spline with the tangents
modified to ensure the monotonicity of the resulting Hermite spline.
An algorithm is also available for monotone quintic Hermite interpolation.
There are several ways of selecting interpolating tangents for each data point.
This section will outline the use of the Fritsch–Carlson method.
Note that only one pass of the algorithm is required.
Let the data points be
indexed in sorted order for
δ
δ
δ
δ
δ
β
δ
β
β
τ
β
δ
β
δ
.After the preprocessing above, evaluation of the interpolated spline is equivalent to cubic Hermite spline, using the data
, find the index
Calculate then the interpolated value is where
{\displaystyle h_{ii}}
are the basis functions for the cubic Hermite spline.
The following JavaScript implementation takes a data set and produces a monotone cubic spline interpolant function: