0

I need to numerically solve an integral of the form $$\int_0^1\int_0^1|f|.$$ You may assume that $f$ has a first derivative, if it matters.

How should I solve this problem? The scheme should be easy to implement and it does not need to be super sophisticated. However, I've started with $$\frac1{n^2}\sum_{i=1}^n\sum_{j=1}^n\left|f\left(\frac{i-1}n,\frac{j-1}n\right)\right|$$ and that gave me unsatisfactory results.

My first thought was to try Simpson's rule in both dimensions (I couldn't find a reference for the formula in 2d; the one described in this question seems wrong, since no midpoint is evaluated ...).

0xbadf00d
  • 14,208
  • Techniques for numeric integration seems a pretty wide topic. One technique is just to randomly sample points $(x,y)\in[0,1]^2$ and take the average of $|f(x,y)|.$ But your technique of picking a specific set of $n^2$ points is okay, too. It really depends on what you know about $f.$ – Thomas Andrews Dec 23 '22 at 22:10
  • @ThomasAndrews If it helps, the particular functions I want to integrate are in eq. (3) and (7) of this paper for $\Omega=[0,1)^2$. – 0xbadf00d Dec 23 '22 at 22:15
  • Other than that, the 3-dimensional version of the trapezoid rule seems like it will be slightly better than the simple form you've got. But I'm not sure what that $3$-d form is. – Thomas Andrews Dec 23 '22 at 22:33

0 Answers0