Statistical Methods

Check a numerical derivative across step sizes

Define the task

Identify the input coordinate, its units and the output being differentiated. A numerical derivative describes a local change in that output per unit change in the input. Freeze all other inputs while evaluating the function. A stochastic function needs a reproducible evaluation scheme before differences can be interpreted.

Carry out the check

For a forward difference, subtract f(x) from f(x+h) and divide by h. For a centered difference, use f(x+h) minus f(x−h) divided by twice h. Repeat at smaller steps and compare results. Large steps can hide curvature, while very small steps amplify subtraction error or noise. The centered formula is useful only when both sides are within the function's domain.

Worked hypothetical example

For hypothetical f(x)=x² at x=2 and h=0.1, the three values are 3.61, 4 and 4.41. Forward difference gives 4.1, backward difference gives 3.9 and centered difference gives 4, matching the analytic derivative. Agreement in this quadratic example does not guarantee accuracy for another function. Record the step and evaluation values so another analyst can reproduce the check.

Method checked 14 November 2026 against SciPy documentation: approx_fprime.

Open the finite difference comparison calculator.

Download the derivative step sensitivity grid.

Related reading

Reading path: Analyze data. Guide 135 of 142. Choose any guide to suit your project.

Statistical Methods

Identify which matrix norm a numerical report uses

Compare absolute row sums, column sums and Frobenius magnitude. Includes a worked matrix example and reproducibility checks.

Statistical Methods

Scale Predictors for Numerical Stability Without Losing Units

Record transformations and back-transform coefficients so numerical convenience does not change the reported effect.

Browse this reading pathTools for this stageGuides and downloads for this stage