bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / stats / _finite_differences / _derivative
function
scipy.stats._finite_differences:_derivative
source: build-install/usr/lib/python3.14/site-packages/scipy/stats/_finite_differences.py:69
Signature
def _derivative(func, x0, dx = 1.0, n = 1, args = (), order = 3)Summary
Find the nth derivative of a function at a point.
Extended Summary
Given a function, use a central difference formula with spacing dx to compute the nth derivative at x0.
Parameters
func: functionInput function.
x0: floatThe point at which the nth derivative is found.
dx: float, optionalSpacing.
n: int, optionalOrder of the derivative. Default is 1.
args: tuple, optionalArguments
order: int, optionalNumber of points to use, must be odd.
Notes
Decreasing the step size too small can result in round-off error.
Examples
def f(x): return x**3 + x**2✓
_derivative(f, 1.0, dx=1e-6)
✗np.float64(4.999999999921734)
Aliases
scipy.stats._distn_infrastructure._derivative