This is an update to my question [Rigorous numerical integration](https://mathoverflow.net/questions/123677/rigorous-numerical-integration/123683#123683) from three years ago.


Is there now a package for rigorous numerical integration that uses interval arithmetic and has access to a well-developed library of special functions?


By "well-developed", I mean something that, at the very least, includes the error function $\text{erf}$, the incomplete gamma function $\Gamma(s,x)$ and the like. In other words, I would like to integrate expressions involving these functions. VNODE-LP doesn't seem to satisfy this requirement, as it relies on older interval-arithmetic libraries lacking such basic special functions. (Besides, perhaps it is just me, but VNODE-LP actually seems harder to install than three years ago; I am not sure it is being adequately maintained.)


PS. An ideal library would have both arbitrary-precision and double-precision modes, the latter one fast. That isn't really an issue for what I am doing now, but it sounds like a basic desideratum, just as, say, an intuitive interface written in C++ (as opposed to plain C) would be.



Numerical integration using interval arithmetic, nowadays
I develop [Arb](http://fredrikj.net/arb/), an arbitrary-precision interval library with special functions support. There is some code included for integration of complex analytic functions using Taylor series ([documentation](http://fredrikj.net/arb/acb_calc.html)), which in principle should scale nicely to high precision. An example program is available [here](https://github.com/fredrik-johansson/arb/blob/master/examples/integrals.c).


The last test case in the example program is $\tfrac{1}{\pi} \int\_0^{\pi} \cos(10 t - (20+10i) \sin(t)) dt$ ($= J\_{10}(20+10i)$). You can change $\cos$ to $\operatorname{erf}$ (`_acb_poly_cos_series` to `_acb_hypgeom_erf_series`) and check that it works. In fact, the new integrand peaks with a magnitude around $10^{38}$ while the result has magnitude around $10^{15}$, so this is a nice test case for handling severe cancellation. With 20d target accuracy and 60d working precision, the program gives



```
(-1.55...e+24 + 5.83...e+23j)  +/-  (1.27e+103, 1.27e+103j)

```

where the resulting midpoint is inaccurate but correctly enclosed, and with 80d target accuracy and 240d working precision, it gives



```
(868463919173069.624... + 85377491518329.173...j)  +/-  (1.9e-65, 2.37e-66j).

```

This takes 1.5 seconds.


I would not necessarily recommend using this code for anything serious, for a few reasons. First, the interface is very low level and inconvenient to work with. Some kind of high-level wrapper would make sense. (Note that Arb is a Sage package, but no Sage wrapper for this particular code has been written yet.)


Further, the code needs to bound the integrand on a surrounding contour to get error bounds for the series truncations (via the Cauchy integral formula). This is done semi-automatically by evaluating the integrand on "thick" input intervals, subdividing if necessary. This can be slow and might fail to converge. For low precision integration, computing the original integral directly by naive subdivision might be better.


The current version of the code also requires that the user input a radius that is known a priori to isolate the integration path from any singularities. Singularities on the integration path itself are obviously not supported at all.


A more robust way to do integration is with Taylor models, i.e. truncated Taylor series together with bounds on the approximation error that are propagated automatically upon function composition. This is more efficient, and works natively with real analytic functions, or even non-analytic functions like $|x|$. Taylor models could presumably also be extended to Puiseux-type series to support algebraic and logarithmic endpoint singularities. Unfortunately, I'm not aware of any work so far on implementing Taylor models for higher special functions. It's on my list of things to work on...


Some people have also worked on rigorous error bounds for the double exponential integration formula, but I'm not aware of any general-purpose implementations yet.


While this doesn't quite answer your question, you might have some success combining Arb's special functions with other packages for integration. The main caveat is that Arb doesn't always compute very tight enclosures for special functions, which is hard to do in general. For example, the $\operatorname{erf}(x)$ implementation currently computes reasonably tight enclosures, but the $\Gamma(s,x)$ implementation does not ([see this](http://fredrikj.net/blog/2016/03/taking-the-error-out-of-the-error-function/)). This doesn't matter much for algorithms that only sample the integrand at discrete points (it's enough to increase the precision by $p$ bits to circumvent $p$ bits of cancellation), but it can be an obstacle for algorithms that need enclosures on "thick" input intervals (subdividing requires $2^p$ function evaluations).


