Univariate

Overview

Univariate interpolation is the process of estimating unknown values of a function between known data points. Given a set of discrete points (x_i, y_i), the goal is to construct a continuous function f(x) that passes through all the data points (f(x_i) = y_i) and can be evaluated at any intermediate value. This is fundamental in numerical analysis, data visualization, engineering simulations, and scientific computing where measured or sampled data is inherently discrete but the underlying phenomenon is continuous.

The choice of interpolation method depends on several factors: the nature of the data, desired smoothness properties, computational efficiency, and behavior outside the data range. Some methods produce smooth curves (cubic splines), others preserve monotonicity (PCHIP), and some minimize oscillations (Akima splines). Understanding these trade-offs is essential for selecting the appropriate technique.

Polynomial Interpolation

Polynomial interpolation fits a single polynomial of degree n-1 through n data points. While theoretically elegant, high-degree polynomials can exhibit Runge’s phenomenon—severe oscillations between data points, especially near the boundaries.

Piecewise Polynomial Methods

Rather than fitting a single high-degree polynomial, piecewise methods divide the domain into segments and fit lower-degree polynomials within each segment. This approach avoids oscillations while maintaining local control over the interpolant.

  • Cubic splines are the most widely used piecewise interpolation method. They fit cubic polynomials between each pair of data points while enforcing continuity of the function, first derivative, and second derivative at the knots. This produces a smooth, visually pleasing curve. The CUBIC_SPLINE function implements natural, clamped, and periodic boundary conditions.

  • Hermite splines extend cubic interpolation by allowing you to specify both function values and derivatives at the data points. This gives precise control over the shape of the interpolant. The HERMITE_SPLINE function is ideal when derivative information is available from physical constraints or theoretical models.

Shape-Preserving Interpolation

When interpolating data that should remain monotonic or preserve certain qualitative features (like peaks and valleys), specialized methods are needed:

  • PCHIP (Piecewise Cubic Hermite Interpolating Polynomial) preserves the monotonicity of the original data—if the data is increasing between two points, the interpolant will also be increasing. This avoids the non-physical oscillations that can occur with standard cubic splines. The PCHIP_INTERPOLATE function is particularly valuable for financial data, physical measurements, and other applications where overshooting is unacceptable.

  • Akima splines are designed to minimize the influence of outliers and avoid oscillations near abrupt changes in the data. Unlike cubic splines, which balance smoothness globally, Akima’s method uses local polynomial fitting that adapts to the local behavior of the data. The AKIMA_INTERP function is excellent for noisy or irregular data.

General-Purpose Interpolation

The INTERP1D function provides a unified interface to multiple interpolation methods: linear, nearest-neighbor, quadratic, cubic, and spline-based approaches. This flexibility makes it ideal for exploratory analysis where you want to compare different interpolation strategies on the same dataset.

Native Excel capabilities

Excel provides basic interpolation capabilities but they are limited and often require manual implementation:

  • FORECAST and FORECAST.LINEAR: Linear interpolation and extrapolation for a single point. This is equivalent to drawing a straight line between two data points.
  • TREND: Fits a linear regression line, which is extrapolation/approximation rather than true interpolation.
  • LINEST: Polynomial regression (not interpolation) using least-squares fitting.
  • Chart trendlines: Excel can display polynomial, logarithmic, exponential, and moving average trendlines on charts, but these are visual aids rather than computational tools.

None of these tools provide true cubic spline interpolation, shape-preserving methods, or the ability to efficiently evaluate interpolants at arbitrary points. Users typically resort to manual implementations using arrays of formulas, which are error-prone and inefficient for large datasets.

Third-party Excel add-ins

  • XLSTAT: Provides advanced interpolation methods including spline interpolation and polynomial fitting as part of its statistical analysis toolkit.
  • NumXL: A time series and econometric analysis add-in that includes linear and cubic spline interpolation functions, particularly useful for filling gaps in financial time series.
  • Solver: While primarily an optimization tool, Frontline Systems’ Solver includes some curve-fitting capabilities that can be used for interpolation-like tasks.

Despite these options, the Python-based functions in this library offer significantly more flexibility, performance, and access to the state-of-the-art algorithms implemented in SciPy’s interpolation module.

Tools

Tool Description
AKIMA_INTERP Akima 1D interpolation.
BARYCENTRIC_INTERP Interpolating polynomial for a set of points using barycentric interpolation.
CUBIC_SPLINE Cubic spline data interpolator.
HERMITE_SPLINE Piecewise-cubic interpolator matching values and first derivatives.
INTERP1D Interpolate a 1-D function.
KROGH_INTERPOLATE Krogh polynomial interpolation.
PCHIP_INTERPOLATE PCHIP 1-D monotonic cubic interpolation.