I want to carry out an integral of this form
\int_{0}^{\infty} \int_{0}^{t_{n}} \ldots \int_{0}^{t_2} \ f(s_1, \ldots, s_n)\, \mathrm{d}s_1 \ldots \mathrm{d}s_n ,
for n \approx 10. The domain of integration here is S=\{t\in \mathbb{R}^n: 0 \leq t_1 \leq \ldots \leq t_n\} . I don’t know if there is already a name for this region, so let’s call it an ordered domain on \mathbb{R}^n.
looking at Integrals.jl, one of the FAQs is “How can I integrate on arbitrary geometries?” to which the answer
You can’t, since Integrals.jl currently supports integration on hypercubes because that is what lower-level packages implement.
So my question is, are there any packages or methods that allow me to (fairly) efficiently (and hopefully fairly easily) compute my integral?
Of course, I could define a function g(t) = f(t) on S and zero elsewhere, and then integrate g on \{t \in \mathbb{R}^n: t_i > 0\}, but this would be very inefficient as a lot of time would be lost sampling points where the function is zero. So I am looking for a better solution.
MeshIntegrals.jl is a good start, specially if your domains are physical domains.
1 Like
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
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.)
2 Likes
Thanks for your answer. And yes, my limits on the integral were wrong.