Computes elementwise the integral of the piecewise linear function defined by \(f(x_i) = y_i\) (trapezoidal rule)
the missing x parameter is assumed equal to be an arithmetic progression of common difference h (1 if h is omitted).
the missing y parameter is assumed equal to the call of f applied to the x elements
the computation is made with the upgraded types
Internal summation use kahan algorithm for better accuracy
Note
definition of f or of y ?
If f is a parameter the y values are defined by \(y_i = \mathrm{f}(x_i)\) and x or xsmust be defined
If y (or ys...) is a parameter f is defined by \(f(x_i) = y_i\). and the values of \(x_i\) are not needed as they are equally spaced with space h (defaulted to one).
If x (or xs ...) is a parameter its must be sorted in increasing order.