numpy.trapz — NumPy v1.22 Manual
numpy.org › doc › stablenumpy.trapz¶ numpy. trapz (y, x = None, dx = 1.0, axis =-1) [source] ¶ Integrate along the given axis using the composite trapezoidal rule. If x is provided, the integration happens in sequence along its elements - they are not sorted. Integrate y (x) along each 1d slice on the given axis, compute \(\int y(x) dx\).