AI system to help scientists write expert-level empirical software
from Google Research
The paper covers various applications. I am excerpting the part where they develop software that computes integrals that Quadpack (wrapped in scipy) cannot. The integrals are listed in Figure 19. It would be interesting to see verify their results for Quadpack and to see if other Fortran quadrature libraries perform.
Numerical Analysis: Library for numerical evaluation of difficult integrals
Finally, we turn to a problem in numerical analysis, the numerical evaluation of difficult integrals
using Gaussian quadratures. The gold standard was developed by U.S. government research
laboratories in the 1980s, widely used as the core library underlying the popular Python function
scipy.integrate.quad(). Nonetheless, this function can fail in multiple ways, among them: the
underlying algorithm can fail to converge; the algorithm samples its integrand, and the sampling may miss important features; the algorithm loses precision when the problem exhibits precise cancellations.While standard techniques exist to address these problems, we asked whether our method could
build a general-purpose method superior to quad(), by hill climbing on a benchmark set of integrals
where the standard algorithm fails but where the analytic answer to the integral is known. We
constructed this set of integrals from a standard applied mathematical reference book60, focusing on oscillatory integrals with infinite upper limits and without other pathologies, but where the standard quad() library returned an incorrect answer. This led to a set of 38 integrals (Supplementary Fig. 19). We split these in half at random, using 19 for scoring the search and holding out the other 19 for evaluation. We then initialized our method with a simple invocation of quad() and prompted the system to improve it, scoring solutions with the logarithm of the absolute fractional error, where the logarithm prevented the search from over-weighting outliers. Supplementary Fig. 20 shows the resulting breakthrough plot and tree structure for the search.
The best solution builds on quad() by partitioning the infinite domain into a sequence of contiguous,
finite subintervals whose lengths may increase geometrically to cover the domain’s tail more efficiently. The definite integral is thus transformed into an infinite series, where each term is the numerical integral of the integrand over one of these finite segments, calculated using quad(). For integrals that converge slowly, such as those with oscillatory integrands, direct summation of this series is impractical.ite subintervals whose lengths may increase geometrically to cover the domain’s tail more efficiently.