derivkit.derivatives.finite.core module#
Finite difference derivative estimation with a single step size.
- derivkit.derivatives.finite.core.single_finite_step(function, x0: float, order: int, stepsize: float, num_points: int, n_workers: int) ndarray[tuple[Any, ...], dtype[_ScalarT]] | float#
Returns one central finite-difference estimate at a given step size h.
- Parameters:
function – The function whose derivative is to be estimated. Must accept a float or NumPy array and return a float or NumPy array.
x0 – The point at which to evaluate the derivative.
order – The order of the derivative to compute.
stepsize – The step size (h) used to evaluate the function around x0.
num_points – The number of points in the finite difference stencil. Must be one of [3, 5, 7, 9].
n_workers – The number of workers to use in multiprocessing. Default is
1.
- Returns:
The estimated derivative. Returns a float for scalar-valued functions, or a NumPy array for vector-valued functions.
- Raises:
ValueError – If the combination of
num_pointsandorderis not supported.