# Set the FunctionInterpolation step

Is there a way to specify the grid spacing for interpolation?

For example I would like the values of a to change in step of 0.34. How can I write this step in the FunctionInterpolation?

f = FunctionInterpolation[NIntegrate[-a*(x - 5)^2 - 3 Sqrt[y] + Cos[x], {x, 0, 10}, {y, 0, 3}], {a, 0, 3}]

And what is default step Mathematica uses?

• Not an answer but I always used Interpolation and made the list using Table. Oct 1, 2022 at 16:31
• is it impossible to do for FunctionInterpolation? Oct 1, 2022 at 16:49

\$Version

(* "13.1.0 for Mac OS X x86 (64-bit) (June 16, 2022)" *)

Clear["Global*"]

f[a_?NumericQ] :=
NIntegrate[-a*(x - 5)^2 - 3 Sqrt[y] + Cos[x], {x, 0, 10}, {y, 0, 3}]


You can specify the step size using the standard form for an iterator.

fi = FunctionInterpolation[f[a], {a, 0, 3, 0.34}]


However, the iterator stops at 2.72 and the upper portion of the interval {0, 3} then requires extrapolation.

fi[2.9]

(* bInterpolatingFunction::dmval: Input value {2.9} lies outside the range of data in the interpolating function. Extrapolation will be used. *)

(* -830.555 *)

Plot[{f[a], fi[a]}, {a, 0, 3},
PlotStyle -> {Automatic, Dashed},
PlotLegends ->
Placed["Expressions", {.8, .65}]]


• When I write this line fi = FunctionInterpolation[f[a], {a, 0, 3, 0.34}]` Mathematica highlights step (this part , 0.34) in red, like a mistake in syntax. Oct 1, 2022 at 18:26
• Does the code execute as expected despite the red color? If not, what version are you running and on what OS? Oct 1, 2022 at 18:49
• I'm running Mathematica 12.0 on Windows 10. But surprisingly it executes correctly. Is it possible to change it? Oct 1, 2022 at 20:27
• I'm confused. If it executes correctly, what do you want to change? Oct 1, 2022 at 22:23
• It's just weird to see some red code. Oct 1, 2022 at 23:09