you can do:
FunctionInterpolation[if[x], {x, 1, 2}]
which will actually sample the interpolation function and generate a new one.
Alternately you can extract the data and use Interpolation
Interpolation[
Select[ Transpose[{#[[3, 1]], Flatten[#[[4]]]}] ,
1 <= #[[1]] <= 2 &]] &@if
This second method may not exactly match your desired domain boundaries unless they happened to be sample points on the original interpolation.
In both cases the result will not be precisely the same as the original interpolation.
yet another thing you can do, which seems a bit of a hack. Looking at the FullForm of InterpolatingFunction you see the first argument is the domain, so if you do:
if[[1]] = {{1, 2}}
you will get a warning if you go out of the new bounds (but get the same result as the original)
Edit: this will use the derivatives from the first interpolation in the second:
data = Select[Transpose[{#[[3, 1]], Flatten[#[[4]]]}],
1 <= #[[1]] <= 2 &] &@if;
Interpolation[{{#[[1]]}, #[[2]], D[if[x], x] /. x -> #[[1]]} & /@ data]
FunctionInterpolation? When I try it on actual interpolating functions, it clearly reduces the quality of the originalif. – anderstood Oct 31 '16 at 17:40Interpolation[Table[f[x],..]]to sample as many points as you like (you do loose adaptive refinement that way though) – george2079 Oct 31 '16 at 17:48FunctionInterpolationproduces a different method interpolation thanNDSolve. – Michael E2 Nov 01 '16 at 00:22if[[1]] = {{1, 2}}. However I store the whole function (typically defined on a 20 times larger interval) which is really suboptimal. Do you think it's possible to chop oup the points out of something like{{0.9,2.1}}, i.e. keep the same interpolation points in the interval of interest, and crop most of the unused parts? – anderstood Nov 12 '16 at 23:54