What am I doing with this triple integral?

98 Views Asked by At

I am new here and hope my question is clear and is straight to the point. The following is a form of an integral I am trying to compute.

$$\int_{x}\int_{y}\int_{z} f(x,y,z) g(x,y)\ dz \ dy \ dx \ $$

Assume that I tackle this problem (for some reason because its extremely hard to find in closed form) in the following way

  1. First assign values of x and y, for example $$x=0:0.1:1000$$ $$y=0:0.1:1000$$ and then compute the following

$$Y(i,j)= \int f(x(i),y(j),z) \ dz $$

where $i$ and $j$ are indices that run through the length of $x$ and $y$.

  1. Next I take sample mean of $Y$. Let us call this average $$ \mu_y$$

  2. I compute the following integral $$\int_{x}\int_{y} \mu_y \ g(x,y) \ dy \ dx \ $$

which in my case is easy to compute !

As you see these steps are suboptimal, I simply want to have your expert opinion on this method.

a- When is my approximation good, i.e under what conditions ?

b- Do you have any other suggestions on how to approach optimality?

Thanks and hope it was clear.

1

There are 1 best solutions below

8
On BEST ANSWER

I could see a problem with some kinds of functions:

Let the domain of integration be $[0,1]^3$,

$$ f(x,y,z) = \begin{cases} \alpha &: 0 \leq x,y \leq \frac12, \\ 0 &: \textrm{otherwise}; \end{cases}\\ g(x,y) = \begin{cases} 0 & : 0 \leq x,y, \leq \frac12,\\ 1 &: \textrm{otherwise}; \end{cases} $$ Then $\int\int\int fg\,dx\,dy\,dz=0$, but $\int\int\mu g\,dy\,dx = \frac{\alpha}{16}$ (so for large $\alpha$, the error is proportionally large). The problem is that you're levelling-out $f$, including its support, so if $g$ has disjoint support, that fact gets lost by your approximation. Similarly, if $f$ and $g$ are concentrated around the same points in $x,y$, then the actual integral could be much larger than the approximate one.

I would say, as long as you're discretizing and approximating, just go all the way and use the "trapezoid" rule (you should be able to find coded examples on the internet).