quadax.cumulative_trapezoid
- quadax.cumulative_trapezoid(y: Array | ndarray | bool | number | bool | int | float | complex, *, x: None | Array | ndarray | bool | number | bool | int | float | complex = None, dx: Array | ndarray | bool | number | bool | int | float | complex = 1.0, axis: int = -1, initial: Array | ndarray | bool | number | bool | int | float | complex | None = None) ArraySource
Cumulatively integrate y(x) using the composite trapezoidal rule.
- Parameters:
y (
array_like) – Values to integrate.x (
array_like, optional) – The coordinate to integrate along. If None (default), use spacingdxbetween consecutive elements iny.dx (
float, optional) – Spacing between elements ofy. Only used ifxis None.axis (
int, optional) – Specifies the axis to cumulate. Default is -1 (last axis).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 atx[0]is returned andreshas one element less thanyalong the axis of integration.
- Returns:
res (
ndarray) – The result of cumulative integration ofyalongaxis. Ifinitialis None, the shape is such that the axis of integration has one less value thany. Ifinitialis given, the shape is equal to that ofy.