This Julia package exports exactly one function quadosc()
that is used to
integrate oscillatory functions to infinity. The algorithm works by integrating
the integrand between successive zeros using QuadGK and then summing the
resulting alternating series with a series acceleration, either using Wynn's
epsilon algorithm from 1956 (by default) or the algorthm described in
Cohen et al 2000.
Given an oscillatory function fn(x)
,
julia> using QuadOsc
julia> a = 0.0
julia> I, E = quadosc(fn, a, Inf, n->fnzeros(n))
integrates fn(x)
from a
to infinity, and fnzeros(n)
is the n
-th zero of
fn(x)
. That is, fn(fnzeros(n)) == 0
for integer n
.
The series acceleration is available via
julia> ak = @. (-1)^(1:5) / (1:5)
julia> sum_ak = QuadOsc.accel_cohen_villegas_zagier(ak)
or
julia> sum_ak = QuadOsc.accel_wynn_eps(ak)
Tests can be run by loading the package, entering package mode with pressing
]
, and calling test
on the package:
julia> using QuadOsc
pkg> test QuadOsc
'nuff said?