deriv1¶
-
deriv1(h, y, /, axis=0, accuracy=2, keepleft=False, keepright=False, keepedges=False)[source]¶ Return an estimate of the first derivative along an arbitrary axis using first order centered finite differencing.
- Parameters
h (float or array-like) – The step size. If non-singleton, the step size is
h[1] - h[0].y (array-like) – The data.
- axisint, optional
Axis along which derivative is taken.
- dimstr, optional
For `xarray.DataArray` input only. Named dimension along which the derivative is taken.
- accuracy{{0, 2, 4, 6}}, optional
Accuracy of finite difference approximation.
0corresponds to differentiation onto half-levels.2,4, and6correspond to centered accuracies of \(h^2\), \(h^4\), and \(h^6\), respectively. See this wikipedia page for the table of coefficients for each accuracy.- keepleft, keepright, keepedgesbool, optional
Whether to fill left, right, or both edge positions with progressively lower-
accuracyfinite difference estimates to prevent reducing the dimension size along axisaxis.
- Returns
diff (array-like) – The “derivative”. The length of axis
axismay differ fromydepending on thekeepleft,keepright, andkeepedgessettings.
See also