When using NIntegrate
, say in two-dimensions, is it possible to specify the points of the grid Mathematica will use? For example, if the integrand was a function f[x,y]
given as a list at specific points only of x
and y
and we don't want to Interpolate it over other points, is there a way to make Mathematica do something like
NIntegrate[f[x,y],{x,0,10},{y,0,10}]
using only the given known values of f
on that list?
How does NIntegrate
work in such cases? And if specifying grid points for it is possible, is there a common approach or rule of thumb to know when the grid is refined enough to give correct answer (within some error criterion, say 0.1%)? I suspect one wouldn't stop immediately after it first passes the criterion, but may want that to repeat a few times to be sure it converges. Any common practice for this?
The motivation behind this question is to learn how to numerically integrate a function given by a finite list, without interpolating it.
"TrapezoidalRule"
or use a linear interpolation of the gridpoints. $\endgroup$NIntegrate
. This effectively applies the correct quadrature rules. See this answer, for example. $\endgroup$