I am using Interpolation
to construct an InterpolatingFunction
from several points. I do not need a higher order InterpolationOrder
than 1.
I wonder, in this case, is the contructed InterpolatingFunction
simply a piecewise linear function? My goal is to Integrate that function, but due to performance reasons, I need to get the primitive function (evaluate the non-definite integral first). But I am wondering, whether this can be done and whether the result would be piecewise quadratic function so that the operation $F(x_i)$, where $F(x)=\int f(x)\,{\rm d} x$ and $f(x)$ is the InterpolatingFunction
is as fast as plugging into a piecewise defined $\tilde{F}(x) = a_ix^2+b_ix +c_i$.
So in Mathematica, the code should look like:
f=Interpolation[data, InterpolationOrder -> 1];
F[x_]:=Integral[f[x],x];
result = Exp[F[#]]&/@biglistofx;
Are there any other performance issues that I should be aware when using Interpolation
and its integration?
If the Interpolation
does not produce a piecewise linear function, what would be my best approach to make the above calculation as fast as possible (note that Length@biglistofx
$\sim 10^7$)?