Numerically integrate bivariate function

Click For Summary
Numerical integration of bivariate functions can be approached by partitioning the integration interval and applying methods like the midpoint rule for approximations. Transforming to polar coordinates can simplify the integration process, allowing for the evaluation over a finite rectangle. Substituting variables, such as using arctanh, can help avoid singularities at the boundaries of integration. Discussions also highlight the importance of selecting appropriate algorithms that do not require evaluation at problematic points, like s = 1 or r = 0. Resources like the Burden-Faires textbook provide guidance on numerical methods for approximating integrals.
sunrah
Messages
191
Reaction score
22
What methods are available for integrating, e.g.
<br /> \int^{\infty}_{0} f(x) dx \int^{x}_{0} g(x,y) dy<br />

numerically without resorting to symbolic integration. Thanks
 
Physics news on Phys.org
Assuming that the integral exists and there is a sufficiently large x for which the function is approximately zero, then you could look at this as a bounded integral.
## \int_0^L\int_0^x f(x) g(x,y) dy dx ##
Numerically, you would partition the interval from 0 to L with N+1 points ##\{x_i\}_{i=0}^N##, such that ##x_0 = 0 ## and ##x_N = L. ##
Then you would have a region of integration that grows like half a square.

If you apply a midpoint rule for a simple approximation, this might look like ( with ##dx_i = x_i - x_{i-1}##) :
## \int_0^L\int_0^x f(x) g(x,y) dy dx \approx \sum_{ i = 1 }^N dx_i f\left( \frac{x_i + x_{i-1}}{2}\right) \sum_{j=1}^i dx_j g\left(\frac{x_i + x_{i-1}}{2}, \frac{x_j + x_{j-1}}{2} \right)##

Does that help?
 
I think I would first move to polar coordinates, so that I = \int_0^\infty \int_0^x f(x)g(x,y)\,dy\,dx = <br /> \int_0^\infty \int_0^{\pi/4} f(r\cos\theta) g(r\cos\theta, r\sin\theta) r\,d\theta\,dr. Then I'd set r = \mathrm{arctanh}(s) so that <br /> I = \int_0^1 \int_0^{\pi/4} f(\mathrm{arctanh}(s)\cos\theta) g(\mathrm{arctanh}(s)\cos\theta, \mathrm{arctanh}(s)\sin\theta) \frac{\mathrm{arctanh}(s)}{1 - s^2}\,d\theta\,ds.
Now I'm integrating over a finite rectangle, and I probably want to use an algorithm which doesn't require me to evaluate the integrand at s = 1.

Alternatively, I could split the integral as <br /> \int_0^1 \int_0^{\pi/4} f(r\cos\theta) g(r\cos\theta, r\sin\theta) r\,d\theta\,dr + \int_1^\infty \int_0^{\pi/4} f(r\cos\theta) g(r\cos\theta, r\sin\theta) r\,d\theta\,dr
and in the second integral make the substitution z = 1/r, to obtain <br /> I = \int_0^1 \int_0^{\pi/4} f(r\cos\theta) g(r\cos\theta, r\sin\theta) r<br /> + f(r^{-1}\cos\theta)g(r^{-1}\cos\theta,r^{-1}\sin\theta)r^{-3}\,d\theta\,dr<br /> and this time I probably want to use an algorithm which doesn't require me to evaluate the integrand at r = 0.
 
  • Like
Likes sunrah
pasmith said:
use an algorithm which doesn't require me to evaluate the integrand at s = 1

Thanks, the change of variables is intuitive, but I don't know any algorithms?
Also, in the last step in your alternative procedure shouldn't the second integral be over z not r?
 
Last edited:
For algorithms I suggest the Burden Faires, 8th edition, there is a section regarding the approximations of single and double integrals ...
 
There are probably loads of proofs of this online, but I do not want to cheat. Here is my attempt: Convexity says that $$f(\lambda a + (1-\lambda)b) \leq \lambda f(a) + (1-\lambda) f(b)$$ $$f(b + \lambda(a-b)) \leq f(b) + \lambda (f(a) - f(b))$$ We know from the intermediate value theorem that there exists a ##c \in (b,a)## such that $$\frac{f(a) - f(b)}{a-b} = f'(c).$$ Hence $$f(b + \lambda(a-b)) \leq f(b) + \lambda (a - b) f'(c))$$ $$\frac{f(b + \lambda(a-b)) - f(b)}{\lambda(a-b)}...

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 25 ·
Replies
25
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 31 ·
2
Replies
31
Views
4K
  • · Replies 11 ·
Replies
11
Views
3K