# 2D integration over non-rectangular domain using cubature

**URL:** https://discourse.julialang.org/t/2d-integration-over-non-rectangular-domain-using-cubature/2991
**Category:** New to Julia
**Created:** [March 31, 2017, 5:29pm UTC](https://discourse.julialang.org/t/2d-integration-over-non-rectangular-domain-using-cubature/2991 "2017-03-31T17:29:00Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [April 6, 2017, 12:38am UTC](https://discourse.julialang.org/t/2d-integration-over-non-rectangular-domain-using-cubature/2991/7 "2017-04-06T00:38:22Z")

</div>

> [@Olivier\_Merchiers](#):
>
> Ok, I will stick with two-step approach then.

I would recommend trying a change of variables to turn the integration region into a rectangle. For example, let y=u/x, so that the integral becomes

![](https://global.discourse-cdn.com/julialang/original/3X/3/5/354702f3d5277df2b3e82de4240b8beda7e6f204.jpeg)

In general, a 2d cubature code can be more efficient than nested 1d quadratures, assuming you are using adaptive quadrature/cubature. This is because the inner 1d integral, if it is performed as an independent 1d adaptive quadrature, can waste a lot of integrand evaluations trying to refine the 1d integral to high relative accuracy even if its overall contribution to the integral is small.

(There are also specialized cubature algorithms for triangular domains, but I’ve never seen an implementation of a nested/adaptive one.)

---

_[View the full topic](https://discourse.julialang.org/t/2d-integration-over-non-rectangular-domain-using-cubature/2991)._
