Integration over implicit region

Hi there,

this is more of a package existence than anything else. There is one functionality in Wolfram Mathematica, which I have never seen implemented in any open source software package. Neither for Julia nor for any other language. That is the integration over an implicit region. In Mathematica, it is possible to integrate over an implicit region as easily as

NIntegrate[f(x), x \in R];

where R is the implicit region. A more thorough and comprehensive example can be found here:

Now I find this feature really immensely useful, and therefore would like to have something similar in Julia. Therefore I would like to know if there is something like and if yes, where. If no, if anyone has an idea, how to implement something like this.

Thank you in advance!

As far as I know, there isn’t a single package to do all of the things available in Mathematica, however some packages may give you partial capabilities. For example, DomainIntegrals.jl has an interface for domains, but not implicit domains. IteratedIntegration.jl also has an interface for domains that require either an explicit parameterization or that can be represented as polyhedra. This could also be extended to implicit domains or manifolds, since the only requirement for the iterated integration algorithm is to be able to perform optimization over the domain to find the extremal points along the coordinate axes, and to perform elimination of one variable at a time.

What I just mentioned is relevant to numerical integration. It would also be interesting to find out what algorithm Mathematica is using for the symbolic integration in the examples posted.

The boundary integral equation community has also developed methods for integrals over implicit surfaces, for example this paper and this thesis, but building reliable, general-purpose algorithms is often a substantial undertaking, or a research problem, that would need some motivation.


Hello, I have also been looking for stuff like that for some while. I think the C++ package CGAL is ideally suited to to that. The central idea is to generate a triangulated mesh of the implicit region (see this:CGAL 5.6.1 - Surface Mesh: User Manual) and then sum the target function over central point of triangles weighted by their areas. There’s also a julia wrapper for CGAL (GitHub - rgcv/CGAL.jl: CGAL meets Julia), though I haven’t used that yet.

Thanks a lot!

I will try that out when I have time!

That seems not ideal for quadrature, since for numerical integration you usually want to be able to integrate smooth functions to nearly machine precision. A triangulated mesh will have low-order accuracy.

1 Like

In that field they are solving even more difficult problems involving singular integrands. For smooth integrands the algorithms should be easier.

This 2015 algorithm looks promising, just using recursive 1d quadrature and root finding:

1 Like