Need to calculate the area under a curve or data series? Here are some ways to do it.
Integrating a function
Integrating using samples
The scipy.integratepackage offers some ways to do this:`
trapz -- Use trapezoidal rule to compute integral from samples. cumtrapz -- Use trapezoidal rule to cumulatively compute integral. simps -- Use Simpson's rule to compute integral from samples. romb -- Use Romberg Integration to compute integral from (
2**k + 1) evenly-spaced samples.
MATLAB also has similar functions.