This is a simple package to provide functionality for numerically integrating presampled data (meaning you can't choose arbitrary nodes). If you have the ability to evaluate your integrand at arbitrary points, please consider using better tools for the job (such as the excellent FastGaussQuadrature.jl).
Do note that while the code is trivial, it has not been extensively tested and does not focus on numerical precision. Issues, suggestions and pull requests are welcome.
# setup some data
x = collect(-π : π/1000 : π)
y = sin(x)
# integrate using the default TrapezoidalFast method
integrate(x, y)
# integrate using a specific method
integrate(x, y, SimpsonEven())
The currently available methods are:
- Trapezoidal
- TrapezoidalEven
- TrapezoidalFast (default)
- TrapezoidalEvenFast
- SimpsonEven
- SimpsonEvenFast
All methods containing "Even" in the name assume evenly spaced data. All methods containing "Fast" omit basic correctness checks and focus on performance. Consequently, the fast methods will segfault or produce incorrect results if you supply incorrect data (vectors of different lengths, etc.).