Here are two functions whose integral is hard to compute, because the functions are highly oscillatory. The exact values of the integrals are given in the code.
import Numerical.Integration
example :: IO (Double, Double, Int) -- value, error estimate, error code
example = integration (\t -> 8 * cos(2*t/(1-t)) / (64*(1-t)**2 + t**2)) 0 1 1e-4 100000
value :: Double -- approx 1.7677e-7
value = exp (-6) * pi / (2 * exp 10)
example' :: IO (Double, Double, Int) -- value, error estimate, error code
example' = integration (\t -> 6 * cos(2*t/(1-t)) / (36*(1-t)**2 + t**2)) 0 1 1e-4 50000
value' :: Double -- approx 9.6513e-6
value' = exp (-6) * pi / (2 * exp 6)
For the first one, using 100000 subdivisions of the interval (0, 1), the result (after a while) is approximately 1.756e-7
For the second one, using 50000 subdivisions of the interval (0, 1), the result is approximately 9.649e-6
.
So the results are not bad.
I didn’t try “tanh-sinh” but I would bet it provides bad results.
A note: the error code (which should be 0) is totally crazy, a huge number, I don’t know why.