Numerical Derivative Calculator
Estimate the instantaneous slope of a function at any point using a simple, accurate numerical formula.
Function f(x)
Estimated slope of the tangent line at a
- 1
f(a)
f(2) = 4 - 2
f(a + h)
f(2 + 0.00001) = 4.00004 - 3
f(a − h)
f(2 − 0.00001) = 3.99996 - 4
Numerator f(a+h) − f(a−h)
4.00004 − 3.99996 = 0.00008 - 5
Derivative f'(a) = numerator ÷ (2h)
0.00008 ÷ (2 × 0.00001) = 4Central difference: averaging forward and backward slopes cancels the leading error term.
How does this calculator work?
This tool estimates a function's derivative at a point a using the central difference formula f'(a) ≈ (f(a+h) − f(a−h)) / (2h). Choose a function, the point, and a tiny step h (default 1e-5). It returns the slope of the tangent line, accurate to order h² with no symbolic calculus required.
Formula
How this is calculated
Pick a function f from the list, the point a where you want the slope, and a small step h. The calculator evaluates f at a+h and a−h, then applies the central difference formula f'(a) ≈ (f(a+h) − f(a−h)) / (2h). This averages the forward and backward slopes, cancelling the first-order error term so the estimate is accurate to order h², much better than a one-sided difference.
The central difference needs no symbolic algebra: it only samples the function. A step around h = 1e-5 balances truncation error (too large h) against floating-point round-off (too small h). For smooth functions this typically gives 6 or more correct digits. The result is the estimated slope of the tangent line to y = f(x) at x = a.
Assumptions: f must be defined and finite at a, a+h, and a−h. For ln x and sqrt x the point a must be positive; for 1/x the point a must be nonzero. Near singularities, kinks, or very steep regions the estimate degrades because the function is no longer smooth over the sampling interval.
Frequently asked questions
The central difference (f(a+h) − f(a−h)) / (2h) is accurate to order h², while the forward difference (f(a+h) − f(a)) / h is only order h. For the same step size the central formula gives many more correct digits.
Around 1e-5 works well for most smooth functions. Too large and the approximation error grows; too small and floating-point round-off dominates. If results look noisy, try increasing h slightly.
Those functions are undefined outside their domain. ln x and sqrt x require a > 0, and 1/x requires a ≠ 0. The sampling points a±h must also stay in the domain.
Also known as
TG we-Calculate Editorial Team. (2026). Numerical Derivative Calculator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/numerical-derivative-calculator
TG we-Calculate Editorial Team. "Numerical Derivative Calculator." TG we-Calculate. 2026. https://we-calculate.com/calculator/numerical-derivative-calculator.
TG we-Calculate Editorial Team, "Numerical Derivative Calculator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/numerical-derivative-calculator
@misc{wecalculate_numerical_derivative_calculator, title = {Numerical Derivative Calculator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/numerical-derivative-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
