computing integrals in [ ]%timeit midpoint_vec( loopsbest of ms per loop in [ ]%timeit midpoint( loopsbest of per loop in [ ] /( * out[ ] efficiency factor we see that the vectorized version is about times faster ms versus the results for the trapezoidal method are very similarand the factor of about is independent of the number of intervals double and triple integrals the midpoint rule for double integral given double integral over rectangular domain oeaboecd zb zd xy/dydxa how can we approximate this integral by numerical methodsderivation via one-dimensional integrals since we know how to deal with integrals in one variablea fruitful approach is to view the double integral as two integralseach in one variablewhich can be approximated numerically by previous one-dimensional formulas to this endwe introduce help function xand write zb zd zb xy/dydx zd xd /dxa xy/dy each of the integrals zb zd /dxg xd xy/dy can be discretized by any numerical integration rule for an integral in one variable rd let us use the midpoint method ( and start with xd xy/dy we introduce ny intervals on oecd with length hy the midpoint rule for this integral then becomes zd xd ny xy/dy hy xyj / yj hy hy