blend


blend, a Python code which "blends" multidimensional data, that is, performs a kind of interpolation. However, in this case, the data may be known at points, or curves, or planes, and is to be extended to a higher-dimensional domain.

This is a common way of creating a smooth set of data based on a small set of known values. For instance, if we measure the temperature every hour, we naturally assume that the temperature at 2:15 can be approximated by "blending" 1/4 of the temperature at 3:00 and 3/4 of the temperature at 2:00.

Now suppose that we take the temperature at evenly spaced points on the floor of a room. We can again see how to use blending so that, in each little square, we take a blend of the values at the four corners to get the value at any point within the square. Similar ideas can be used with a cube.

More complicated cases might arise where we know the temperature everywhere along lines, or along planes that cut through a cube. Even then, it is possible to blend the data in a smooth and sensible way.

blend() interpolates values based on a set of given data. It can handle input data that is 1, 2, or 3 dimensional. In the general, 3D case, the data can depend on smoothly varying space parameters (R,S,T) or on tabular indices (I,J,K). The data may be given at the corners, edges, or faces of the unit cube. In the (R,S,T) case, blend() can supply an interpolated value at any point in the cube. In the (I,J,K) case, it will fill in tabular values for all intermediate indices.

In the simplest case, where BLEND is only given data values at the endpoints of a line segment, the 4 corners of a square, or the 8 corners of a cube, BLEND is equivalent to linear, bilinear or trilinear finite element interpolation of the data. However, in the more interesting cases where BLEND is given, say, a formula for the data along the sides of the square, or the edges of the cube, the interpolation is called "transfinite", since in theory it samples the input data at more than a finite number of points.

Licensing:

The information on this web page is distributed under the MIT license.

Languages:

blend is available in a C version and a C++ version and a Fortran77 version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

barycentric_interp_1d, a Python code which defines and evaluates the barycentric Lagrange polynomial p(x) which interpolates data, so that p(x(i)) = y(i). The barycentric approach means that very high degree polynomials can safely be used.

chebyshev_interp_1d, a Python code which determines the combination of Chebyshev polynomials that interpolates data, so that p(x(i)) = y(i).

interp, a Python code which parameterizes and interpolates data;

interpolation, a dataset directory which contains datasets to be interpolated.

lagrange_interp_1d, a Python code which defines and evaluates the Lagrange polynomial p(x) which interpolates data, so that p(x(i)) = y(i).

nearest_interp_1d, a Python code which interpolates data using a piecewise constant (PWC) interpolant defined by the nearest neighbor criterion.

pwl_interp_1d, a Python code which interpolates data using a piecewise linear (PWL) function.

test_interp, a Python code which defines test problems for interpolation, provided as (x,y) data.

test_interp_1d, a Python code which defines test problems for interpolation of a function y(x), depending on a 1D argument.

test_interp_2d, a Python code which defines test problems for interpolation of regular or scattered data z(x,y), depending on a 2D argument.

test_interp_fun, a Python code which defines formulas for functions used to test interpolation algorithms at arbitrary arguments.

test_interp_nd, a Python code which defines test problems for interpolation of data z(x), depending on an M-dimensional argument.

triangle_interpolate, a Python code which shows how vertex data can be interpolated at any point in the interior of a triangle.

Reference:

  1. William Gordon,
    Blending-Function Methods of Bivariate and Multivariate Interpolation and Approximation,
    SIAM Journal on Numerical Analysis,
    Volume 8, Number 1, March 1971, pages 158-177.
  2. William Gordon, Charles Hall,
    Transfinite Element Methods: Blending-Function Interpolation over Arbitrary Curved Element Domains,
    Numerische Mathematik,
    Volume 21, Number 1, 1973, pages 109-129.
  3. William Gordon, Charles Hall,
    Construction of Curvilinear Coordinate Systems and Application to Mesh Generation,
    International Journal of Numerical Methods in Engineering,
    Volume 7, pages 461-477, 1973.
  4. Charles Hall, Thomas Porsching,
    Numerical Analysis of Partial Differential Equations,
    Prentice-Hall, 1990,
    ISBN: 013626557X,
    LC: QA374.H29.
  5. Joe Thompson, Bharat Soni, Nigel Weatherill,
    Handbook of Grid Generation,
    CRC Press, 1999.

Source Code:


Last revised on 20 March 2026.