# Integration on an ordered domain

**URL:** https://discourse.julialang.org/t/integration-on-an-ordered-domain/118180
**Category:** Numerics
**Tags:** question, package, integral, integrate
**Created:** [August 14, 2024, 1:03pm UTC](https://discourse.julialang.org/t/integration-on-an-ordered-domain/118180 "2024-08-14T13:03:14Z")
**Posts on this page:** 1
**Showing post:** 3

<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: [August 14, 2024, 2:10pm UTC](https://discourse.julialang.org/t/integration-on-an-ordered-domain/118180/3 "2024-08-14T14:10:57Z")

</div>

> [@IlliaFaraji](#):
>
> So my question is, are there any packages or methods that allow me to (fairly) efficiently (and hopefully fairly easily) compute my integral?

The standard technique if the bounds depend on one another is to use a change of variables. This is the usual, easy way to use hypercube-integration packages with a differently shaped domain. For example, see: [How to Compute the integration of the following formula by HCubature](https://discourse.julialang.org/t/how-to-compute-the-integration-of-the-following-formula-by-hcubature/32269)

> [@IlliaFaraji](#):
>
> The domain of integration here is S=\{t\in \mathbb{R}^n: 0 \leq t\_1 \leq \ldots \leq t\_n\}

If I understand you correctly, this is:

\int\_0^\infty dt\_n \int\_0^{t\_n} dt\_{n-1} \int\_0^{t\_{n-1}} dt\_{n-2} \cdots \int\_0^{t\_2} dt\_1 \,f(t\_1, \ldots, t\_n) 

which can be transformed to a hypercube via the change of variables t\_k = s\_k t\_{k+1} = t\_n \prod\_{j=k}^{n-1} s\_j for s\_{k} \in [0,1]:

\int\_0^\infty dt\_n \int\_0^{1} ds\_{n-1} \int\_0^{1} ds\_{n-2} \cdots \int\_0^{1} ds\_1\, f\left(t\_n \prod\_{j=1}^{n-1} s\_j, t\_n \prod\_{j=2}^{n-1} s\_j, \ldots, t\_n\right) t\_n^{n-1} \prod\_{j=1}^{n-1} s\_j^{j-1} 

(Or add a finite upper bound on t\_n if desired. If you want a semi-infinite t\_n domain like this you may need an [additional change of variables](https://github.com/stevengj/cubature?tab=readme-ov-file#infinite-intervals).)

---

_[View the full topic](https://discourse.julialang.org/t/integration-on-an-ordered-domain/118180)._
