Romberg integration combines trapezoidal integration with Richardson extrapolation for significantly more accurate estimates at slightly more cost than trapezoidal integration alone.
This package uses Trapz.jl for the trapezoidal integration, and then calculates a basic extrapolation.
romberg is meant to be used for integrating discrete points. For integrating a function, there are much better packages available. Additionally, there are a few limitations to
- The points must be equally spaced along
- The number of points - 1 must be a power of 2
- 1-dimensional integration only
Practically, limitation 2 is the most significant, but it is probably possible to relax this in a future update. If these three conditions can be met,
romberg is much more accurate than
I originally considered making a pull request to add this functionality to Trapz.jl, but decided that it makes more sense to keep it separate as it’s a different integration technique. I plan to register it soon.