Package integrate provides functions to compute an integral given a specific list of evaluations.
Trapezoidal estimates the integral of a function f
\int_a^b f(x) dx
from a set of evaluations of the function using the trapezoidal rule. The trapezoidal rule makes piecewise linear approximations to the function, and estimates
\int_x[i]^x[i+1] f(x) dx
(x[i+1] - x[i]) * (f[i] + f[i+1])/2
where f[i] is the value of the function at x[i]. More details on the trapezoidal rule can be found at: https://en.wikipedia.org/wiki/Trapezoidal_rule
The (x,f) input data points must be sorted along x. One can use github.com/gonum/stat.SortWeighted to do that. The x and f slices must be of equal length and have length > 1.
|quad||Package quad provides numerical evaluation of definite integrals of single-variable functions.|