FunctionApproximations`
FunctionApproximations`

NIntegrateInterpolatingFunction

As of Version 6.0, NIntegrate natively supports InterpolatingFunction objects.

NIntegrateInterpolatingFunction[f,{x,xmin,xmax}]

gives a numerical approximation to an integral with InterpolatingFunction objects in the integrand.

NIntegrateInterpolatingFunction[f,{x,xmin,xmax},{y,ymin,ymax},]

gives a numerical approximation to a multidimensional integral.

更多信息和选项

范例

打开所有单元关闭所有单元

基本范例  (1)

A trapezoidal approximation to :

Since is not smooth, NIntegrate will generate a warning message:

Using NIntegrateInterpolatingFunction produces a slightly more accurate answer without any error messages:

In this case the integrand is simply an interpolating function, so you can use Integrate to check:

Scope  (3)

NIntegrateInterpolatingFunction threads element-wise over the first argument:

Complex-valued interpolation:

Multidimensional integrals:

Generalizations & Extensions  (1)

The arguments of the interpolating function may themselves be univariate functions of the integration variables:

Properties & Relations  (1)

A trapezoidal approximation to Sin[π x]:

Accumulate the sampling points used by NIntegrateInterpolatingFunction:

Plot the sampling points. The function is sampled at the x coordinates in the order of the y coordinates:

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:

Increasing the order of the interpolation will produce a smoother function:

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:

Using NIntegrateInterpolatingFunction, the integral is broken up into integrals over a smaller domain, where the integrand is smooth:

Wolfram Research (2010),NIntegrateInterpolatingFunction,Wolfram 语言函数,https://reference.wolfram.com/language/FunctionApproximations/ref/NIntegrateInterpolatingFunction.html.

文本

Wolfram Research (2010),NIntegrateInterpolatingFunction,Wolfram 语言函数,https://reference.wolfram.com/language/FunctionApproximations/ref/NIntegrateInterpolatingFunction.html.

CMS

Wolfram 语言. 2010. "NIntegrateInterpolatingFunction." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/FunctionApproximations/ref/NIntegrateInterpolatingFunction.html.

APA

Wolfram 语言. (2010). NIntegrateInterpolatingFunction. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/FunctionApproximations/ref/NIntegrateInterpolatingFunction.html 年

BibTeX

@misc{reference.wolfram_2024_nintegrateinterpolatingfunction, author="Wolfram Research", title="{NIntegrateInterpolatingFunction}", year="2010", howpublished="\url{https://reference.wolfram.com/language/FunctionApproximations/ref/NIntegrateInterpolatingFunction.html}", note=[Accessed: 25-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_nintegrateinterpolatingfunction, organization={Wolfram Research}, title={NIntegrateInterpolatingFunction}, year={2010}, url={https://reference.wolfram.com/language/FunctionApproximations/ref/NIntegrateInterpolatingFunction.html}, note=[Accessed: 25-November-2024 ]}