Numerical multiple integration

How trapezoid, Simpson and Gauss-Legendre extend to double integrals through product rules and changes of variables.

From one integral to two

On a rectangle R=[a,b]×[c,d], a double integral can be seen as an outer integral of inner integrals. That lets us apply a one-dimensional rule in y and then another in x.

Rf(x,y)dA=ab(cdf(x,y)dy)dx\iint_R f(x,y)\,dA=\int_a^b\left(\int_c^d f(x,y)\,dy\right)dx

Double trapezoid

If h=(b-a)/n and k=(d-c)/m, applying trapezoid in both directions gives product weights: corners weigh 1, edges 2 and interiors 4, all multiplied by hk/4.

Ihk4i=0nj=0mαiβjf(xi,yj)I\approx\frac{hk}{4}\sum_{i=0}^{n}\sum_{j=0}^{m}\alpha_i\beta_j f(x_i,y_j)
Node typeWeight alpha_i beta_j
Esquina / Izkina / Corner1
Borde no esquina / Ertza ez izkina / Edge not corner2
Interior / Barrukoa / Interior4

Double Gauss-Legendre

For Gauss-Legendre, each variable is transformed to [-1,1]. On a rectangle, the factor in front of the sum is the product of both Jacobians.

abcdf(x,y)dydxba2dc2i=1nj=1mcicjf(xi,yj)\int_a^b\int_c^d f(x,y)\,dy\,dx\approx\frac{b-a}{2}\frac{d-c}{2}\sum_{i=1}^{n}\sum_{j=1}^{m}c_i c_j f(x_i^*,y_j^*)