xrscipy.integrate.cumulative_trapezoid
- xrscipy.integrate.cumulative_trapezoid(obj, coord)
cumulative_trapezoid(obj, coord)
- Parameters:
obj (xarray object) – Values to integrate.
coord (string) – The coordinate along which to integrate.
initial (scalar, optional) – If given, insert this value at the beginning of the returned result. Typically this value should be 0. Default is None, which means no value at
x[0]is returned and res has one element less than y along the axis of integration.
- Returns:
res – The result of cumulative integration of y along axis. If initial is None, the shape is such that the axis of integration has one less value than y. If initial is given, the shape is equal to that of y.
- Return type:
ndarray
See also
numpy.cumsum,numpy.cumprodquadadaptive quadrature using QUADPACK
rombergadaptive Romberg quadrature
quadratureadaptive Gaussian quadrature
fixed_quadfixed-order Gaussian quadrature
dblquaddouble integrals
tplquadtriple integrals
rombintegrators for sampled data
odeODE integrators
odeintODE integrators
scipy.integrate.cumulative_trapezoidscipy.integrate.cumulative_trapezoid : Original scipy implementation
Examples
>>> from scipy import integrate >>> import numpy as np >>> import matplotlib.pyplot as plt
Examples
>>> x = np.linspace(-2, 2, num=20) >>> y = x >>> y_int = integrate.cumulative_trapezoid(y, x, initial=0) >>> plt.plot(x, y_int, 'ro', x, y[0] + 0.5 * x**2, 'b-') >>> plt.show()