interpax.approx_df
- interpax.approx_df(x: Array, f: Array, method: str = 'cubic', axis: int = -1, **kwargs)Source
Approximates first derivatives using cubic spline interpolation.
- Parameters:
x (ndarray, shape(Nx,)) – coordinates of known function values (“knots”)
f (ndarray) – Known function values. Should have length
Nxalong axis=axismethod (str) –
method of approximation
'cubic': C1 cubic splines (aka local splines)'cubic2': C2 cubic splines. Can also pass kwargbc_type, same asscipy.interpolate.CubicSpline'catmull-rom': C1 cubic centripetal “tension” splines'cardinal': C1 cubic general tension splines. If used, can also pass keyword parametercin float[0,1] to specify tension'monotonic': C1 cubic splines that attempt to preserve monotonicity in the data, and will not introduce new extrema in the interpolated points'monotonic-0': same as'monotonic'but with 0 first derivatives at both endpoints'akima': C1 cubic splines that appear smooth and natural
axis (int) – Axis along which f is varying.
- Returns:
df (ndarray, shape(f.shape)) – First derivative of f with respect to x.