Numerical Differentiation Calculator

f'(x) ≈ (f(x+h)−f(x))/h

CalculatorsFreeNo Signup
4.9(378 reviews)
All Tools

Loading tool...

About Numerical Differentiation Calculator

A numerical differentiation calculator using finite differences. Computes f'(x) via forward, backward, and central difference formulas. Shows step size sensitivity and truncation error. Select from preset functions to compare with exact derivatives. All calculations are client-side.

Numerical Differentiation Calculator Features

  • Forward diff
  • Central diff
  • Backward diff
  • Error analysis
  • Step size h
Numerical differentiation: f'(x) ≈ [f(x+h)−f(x)]/h (forward, O(h)), [f(x+h)−f(x−h)]/(2h) (central, O(h²)), [f(x)−f(x−h)]/h (backward, O(h)). Central is most accurate. Too small h → round-off error. Optimal h ≈ √ε for forward, ∛ε for central.

How to Use

Select a function:

  • f(x): Function to differentiate
  • x, h: Point and step size
  • Output: Approximate f'(x)

Error Analysis

Forward/backward: error O(h) — truncation. Central: error O(h²). But round-off error grows as O(ε/h). Total error minimized at optimal h. Second derivative: [f(x+h)−2f(x)+f(x−h)]/h².

Higher Derivatives

  • f''(x) ≈ [f(x+h)−2f(x)+f(x−h)]/h²
  • f'''(x) ≈ [f(x+2h)−2f(x+h)+2f(x−h)−f(x−2h)]/(2h³)

Step-by-Step Instructions

  1. 1Select function.
  2. 2Set x and h.
  3. 3Choose method.
  4. 4Compare with exact.
  5. 5Analyze error.

Numerical Differentiation Calculator — Frequently Asked Questions

Why is central difference more accurate?+

Central: f'(x) = [f(x+h)−f(x−h)]/(2h) uses symmetric points. Taylor expansion shows error is O(h²) — the O(h) terms cancel. Forward/backward only use one side, keeping the O(h) error term.

What is the optimal step size?+

Forward: h_opt ≈ √(ε·|f/f''|) ≈ √ε for well-scaled f (≈10⁻⁸ for double precision). Central: h_opt ≈ (ε·|f/f'''|)^(1/3) ≈ ε^(1/3) ≈ 10⁻⁵. Using h too small gives massive round-off errors.

How do I get higher-order accuracy?+

Richardson extrapolation: combine estimates at different h values. D(h) and D(h/2) give O(h⁴) estimate via [4D(h/2)−D(h)]/3. Can be applied recursively (Romberg differentiation). Five-point stencil also gives O(h⁴).

Share this tool: