# is numerical double integral evaluation good enough?

How to evaluate numerically the double integral

$$Q=\int_A{q\;dA}$$

The problem here is that $q$ is not a known function and I obtain it numerically in a 2D grid:

$$q(i,j) = q_{i,j}$$

where $i=1:1:I$ and $j=1:1:J$ are the indices for the discretization in the $xy$ plane.

My first idea was to calculate the double integral as:

$$Q\approx\sum_{i,j}q(i,j)\Delta A=\sum_{i=1}^I\sum_{j=1}^Jq(i,j)A(i,j)$$

where $A(i,j)=\Delta x \Delta y$, given by the uniform discretization of the grid.

Is this method good enough? Some quadrature rules are difficult to apply because I can't evaluate $q$ in the points defined by the quadrature rules. Also, how do I estimate the error bounds on this integration?

• It depends on what you mean by "good enough"? What kind of error are you trying to achieve? What kind of function is $q$ supposed to be? An approximation to a smooth function? Or is $q$ approximating what you believe to be a very discontinuous function? – Merkh Aug 22 '17 at 20:02
• I agree, "good enough" is a little hard to define. I would like to know a way to estimate an upper bound on the absolute error to the exact soluction. – Thales Aug 22 '17 at 22:44
• The function $q$ is actually derived from the solution of a partial differential equation, that I solve numerically using the finite volume method. Given the spatial discretization, I can solve the PDE for the variable $p$ and using $p$, I estimate numerically the gradients to have an approximate value of $q$. It actually is $q_x$ and $q_y$, from the gradients, but since the normal vector to the surfaces are always parallel/perpendicular to the componentes $q_x$ and $q_y$, it doesn't matter in the integrations if it is $q_x$ or $q_y$. – Thales Aug 22 '17 at 22:48
• The integral I am calculating is the flux of $q$ through the area $A$. It can be the flux in the $x$ direction or in the $y$ direction and, since I have the (discretized) values of $q_x(i,j)$ and $q_y(i,j)$, I would like to calculate those fluxes. – Thales Aug 22 '17 at 22:50