numpy.trapz()

numpy.trapz

numpy.trapz(y, x=None, dx=1.0, axis=-1) [source]

Integrate along the given axis using the composite trapezoidal rule.

Integrate y (x) along given axis.

Parameters:

y : array_like

Input array to integrate.

x : array_like, optional

The sample points corresponding to the y values. If x is None, the sample points are assumed to be evenly spaced dx a