({{, (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction])[domain,table]
represents an approximate function whose values are found by interpolation. }})

OpenersNotesSection(Spacer1)Details

(RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) works like (RefLink[Function, paclet:ref/Function]).

(RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction])[…][x] finds the value of an approximate function with a particular argument x.

In standard output format, only the domain element of an (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) object is printed explicitly. The remaining elements are indicated by <>. »

domain specifies the domain of the data from which the (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) was constructed.

If you supply arguments outside of the domain, a warning is generated, and then an extrapolated value is returned.

(RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) objects that take any number of real arguments may be constructed.

You can take derivatives of (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) objects using (RefLink[D, paclet:ref/D]) and (RefLink[Derivative, paclet:ref/Derivative]).

(RefLink[NDSolve, paclet:ref/NDSolve]) returns its results in terms of (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) objects.

OpenersPrimaryExamplesSection(Spacer1)Examples  (8)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Make an (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) object that will go through the given points:

points = {{0,0},{1,1},{2,3},{3,4},{4,3},{5,0}};

Only the domain is shown in standard output format:

ifun = Interpolation[points]

Evaluate the function at a point in the domain:

ifun[2.5]

Plot the function over its domain, showing the interpolation points:

Plot[ifun[x],{x,0,5},Epilog->Point[points]]

Get an (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) object approximating the solution of a differential equation:

ifun=First[u /.NDSolve[{u''[t]+u[t]==0,u[0]==0,u'[0]==1},u,{t,0,π}]]

Plot the function and its derivative:

Plot[{ifun[t],ifun'[t]},{t,0,π}]

Find the indefinite integral of the solution:

Integrate[ifun[t],t]

Plot[%,{t,0,π}]

OpenersExampleSection1(Spacer1)Scope  (5)

Make an (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) with exact data:

points={{0,0},{1,1},{2,3},{3,4},{4,3},{5,0}};ifun=Interpolation[points]

Compute the value using exact arithmetic:

ifun[5/2]

Compute using machine-number arithmetic:

ifun[N[5/2]]

Compute using arbitrary-precision arithmetic:

ifun[N[5/2,20]]

Make a new (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) with numerical values of all the data:

nifun=N[ifun]

With this (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) values are computed using machine arithmetic:

nifun[5/2]

Integrate an (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]):

ifun=Interpolation[{{0,0},{1,1},{2,3},{3,4},{4,3},{5,0}}];

Integrate[ifun[x],{x,0,5}]

Make a new (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) that is the indefinite integral:

indef[x_]=Integrate[ifun[x],x]

Plot[{ifun[x],indef[x]},{x,0,5}]

The derivative of an (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) is another (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]):

ifun=Interpolation[{{0,0},{1,1},{2,3},{3,4},{4,3},{5,0}}];

difun=ifun'

Plot[{ifun[x],difun[x]},{x,0,5}]

Use partial derivatives of an (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) to check the residual for a PDE:

ifun=NDSolveValue[{D[u[t,x],t]==D[u[t,x],x,x],u[0,x]==Exp[-100 x^2],u[t,0]==1,u[t,1]==0},u,{t,0,1},{x,0,1}];

Plot[Derivative[1,0][ifun][1,x]-Derivative[0,2][ifun][1,x],{x,0,1}]

Make an (RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) that takes 4 arguments:

ifun=ListInterpolation[RandomReal[1,{5,5,5,5}],{{0,1},{0,2},{0,3},{0,4}}]

Integrate it across the first and last dimensions:

integ=Integrate[ifun[x1,x2,x3,x4],{x1,0,1},{x4,0,4}]

Plot3D[integ,{x2,0,2},{x3,0,3}]

OpenersExampleSection2(Spacer1)Properties & Relations  (1)

(RefLink[InterpolatingFunction, paclet:ref/InterpolatingFunction]) does a (RefLink[Piecewise, paclet:ref/Piecewise]) polynomial interpolation:

points={{0,0},{1,1},{2,3},{3,4},{4,3},{5,0}};ifun=Interpolation[points]

pf[x_]=Piecewise[{{InterpolatingPolynomial[Take[points,{1,4}], x], x<2},
{InterpolatingPolynomial[Take[points,{2,5}], x], 2≤x<3},
{InterpolatingPolynomial[Take[points,{3,6}], x], x≥ 3}}]

Plot[pf[x]-ifun[x],{x,0,5},PlotRange->All]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Interpolation, paclet:ref/Interpolation])  ▪  (RefLink[CompiledFunction, paclet:ref/CompiledFunction])  ▪  (RefLink[FunctionInterpolation, paclet:ref/FunctionInterpolation])  ▪  (RefLink[Piecewise, paclet:ref/Piecewise])  ▪  (RefLink[InterpolatingPolynomial, paclet:ref/InterpolatingPolynomial])  ▪  (RefLink[BSplineFunction, paclet:ref/BSplineFunction])  ▪  (RefLink[NDSolve, paclet:ref/NDSolve])  ▪  (RefLink[Blend, paclet:ref/Blend])  ▪  (RefLink[FittedModel, paclet:ref/FittedModel])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Numerical Differential Equations, paclet:tutorial/IntroductionToNumericalDifferentialEquations])}, {▪(RefLinkPlain[Expressions with Heads That Are Not Symbols, paclet:tutorial/ExpressionsWithHeadsThatAreNotSymbols])}, {▪(RefLinkPlain[Approximate Functions and Interpolation, paclet:tutorial/ApproximateFunctionsAndInterpolation])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Differential Equations, paclet:guide/DifferentialEquations])}, {▪(RefLinkPlain[Curve Fitting & Approximate Functions, paclet:guide/CurveFittingAndApproximateFunctions])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(Spacer1)▪(RefLinkPlain[(Spacer1)Implementation notes: Numerical and Related Functions, paclet:tutorial/SomeNotesOnInternalImplementation#16712])}})}})