gives a numerical approximation to an integral with InterpolatingFunction objects in the integrand.
gives a numerical approximation to a multidimensional integral.
- To use NIntegrateInterpolatingFunction, you first need to load the Function Approximations Package using Needs["FunctionApproximations`"].
- NIntegrateInterpolatingFunction uses the function NIntegrate, but it breaks up the domain of integration into sections where the InterpolatingFunction objects are smooth.
- If the integrand f does not contain any InterpolatingFunction objects, NIntegrateInterpolatingFunction is equivalent to NIntegrate.
- The arguments of the InterpolatingFunction objects may themselves be univariate functions of the integration variables.
- If the integrand f is simply an InterpolatingFunction object, it is better to use Integrate because this gives a result that is exact for the polynomial approximation used in the InterpolatingFunction object.
- Numerically integrating a multidimensional integral using NIntegrateInterpolatingFunction with InterpolatingFunction objects containing a large number of nodes may take significantly longer than using NIntegrate.
- NIntegrateInterpolatingFunction has the same options as NIntegrate.
Examplesopen allclose all
Basic Examples (1)
Since is not smooth, NIntegrate will generate a warning message:
In this case the integrand is simply an interpolating function, so you can use Integrate to check:
Generalizations & Extensions (1)
Properties & Relations (1)
A trapezoidal approximation to Sin[π x]:
Accumulate the sampling points used by NIntegrate:
With NIntegrate, the nonsmooth behavior of f[x] near the points x= produces an error message and requires many recursive steps to evaluate accurately:
With a smoother function, fewer function evaluations are needed by NIntegrate:
If the interpolation is smooth enough, NIntegrate will require fewer function evaluations than NIntegrateInterpolatingFunction:
Possible Issues (1)
Multidimensional interpolating functions with a large number of nodes may take much longer to integrate using NIntegrateInterpolatingFunction instead of NIntegrate:
With NIntegrate, only one integral is evaluated, but the nonsmooth behavior generates many recursive steps: