[ANN] HAdaptiveIntegration.jl v1.0.0 - Adaptive numerical integration over simplices and orthotopes

The HAdaptiveIntegration.jl package is designed for numerical integration over multidimensional domains. It computes integrals of the form I = \int_{\Omega} f(x) \, \mathrm{d}x where f is any Julia function and \Omega represents domains such as simplices (triangles, tetrahedra, …) and axis-aligned orthotopes (rectangles, cuboids, …). The package employs an adaptive strategy, dynamically refining the integration domain as needed. Embedded cubature rules are used to provide error estimates, with the goal of achieving high accuracy while minimizing the number of function evaluations.

Features include:

  • Adaptive integration over simplices and orthotope of any dimension,
  • Utilization of efficient tabulated cubatures for low-dimensional simplices (triangles and tetrahedra) and orthotopes (rectangles and cuboids),
  • Support for custom embedded cubature rules,
  • Arbitrary precision arithmetic.

Quick Examples

Below are simple examples demonstrating how to use HAdaptiveIntegration to compute integrals over the supported domains:

julia> using HAdaptiveIntegration

# Define a function
julia> f = x -> cis(sum(x)) / (sum(abs2, x) + 1e-2)

# Compute the integral and error estimate over a triangle and a rectangle
julia> I, E = integrate(f, Triangle((0, 0), (1, 0), (0, 1)))
(2.9073045602673253 + 1.2009254989232099im, 4.646511607369907e-8)

julia> I, E = integrate(f, Rectangle((0, 0), (1, 1)))
(3.061858492661162 + 1.7034087551176278im, 4.8525654841517435e-8)

# Compute the integral and error estimate over a tetrahedron and a cuboid
julia> I, E = integrate(f, Tetrahedron((0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 0, 1)))
(0.6767480949657807 + 0.4437444630481043im, 1.2058253541977129e-8)

julia> I, E = integrate(f, Cuboid((0, 0, 0), (1, 1, 1)))
(0.7332718951640882 + 1.2361267744925115im, 2.083830752837712e-8)

Here, I denotes the estimated value of the integral and E the associated error estimate. The integrate function provides many additional options, and several other integration domains are supported. For further details, please refer to the documentation.

Related packages

HAdaptiveIntegration is inspired by HCubature.jl , which implements a similar adaptive approach for integration over orthotopes of arbitrary dimension. The main differences are:

  • HAdaptiveIntegration supports integration over simplices of any dimension, whereas HCubature focuses exclusively on orthotopes.
  • For low-dimensional orthotopes such as rectangles and cuboids, HAdaptiveIntegration uses tabulated cubature rules for improved efficiency, allowing it to reach accuracy comparable to HCubature with fewer function evaluations.

Even if this package contains rule for an arbitrary d-dimensional simplex and orthotope:

  • the dimension d=1 (where both the 1-simplex and 1-orthotope reduce to a line segment) is supported, but we recommend using QuadGk.jl for one-dimensional integration;
  • for large d-dimensional simplex or orthotope, the approach of this package will become slow. In such case, you should try to use stochastic method like in MCIntegration.jl or Cuba.jl.
11 Likes