Skip to content

Interpolation

Constructs a piecewise interpolating function from data points.

$ wo 'Head[Interpolation[{{0, 1}, {1, 4}, {2, 9}, {3, 16}}]]'
InterpolatingFunction

An exact query point over exact data gives an exact value; machine data keeps giving machine values:

$ wo '{Interpolation[{1, 4, 9}][5/2], Interpolation[{1., 4., 9.}][3/2]}'

Interpolation::inhr: Requested order is too high; order has been reduced to {2}.

Interpolation::inhr: Requested order is too high; order has been reduced to {2}.
{25/4, 2.25}

Outside the data range the boundary piece is extended, with a warning:

$ wo 'Interpolation[{{0, 0}, {1, 1}, {2, 4}}][3]'

Interpolation::inhr: Requested order is too high; order has been reduced to {2}.

InterpolatingFunction::dmval: Input value {3} lies outside the range of data in the interpolating function. Extrapolation will be used.
9

f' differentiates the local polynomial piece and is itself an interpolating function, so the prime may be applied directly to the call:

$ wo "f = Interpolation[{{0, 0}, {1, 1}, {2, 4}}]; {f'[1], f''[1], Head[f']}"

Interpolation::inhr: Requested order is too high; order has been reduced to {2}.
{2, 2, InterpolatingFunction}