JuliaLang/julia — pull request #3140 by stevengj (2013-05-17 17:24:40+00:00)
Title: RFC: quadgk integration routine

This patch adds a new routine `quadgk` to Julia:

I,E = quadgk(f, a,b,c...; reltol=eps*100, abstol=0, maxevals=10^7, order=7)

which performs adaptive 1d Gauss-Kronrod integration (addressing issue #1235), returning an estimated integral `I` and error `E`.

For example, `quadgk(cos, 0,1)` integrates `cos` from 0 to 1, returning `sin(1)`. Complex-valued functions and complex endpoints (contour integration) are also supported, as is arbitrary-precision arithmetic. e.g. `quadgk(cos, 0, BigFloat(1), order=40)` integrates `cos` using `BigFloat` arithmetic, with a higher-order rule to get exponential accuracy.

The code is all written from scratch by me, with the most complicated routine being the `kronrod` routine to compute Kronrod points and weights; I implemented this from a pseudo-code description in a well-known 1997 paper by Laurie.