UNIHIVE

Study Hub UNIPORT ENG 303

ENG 303 · Engineering Mathematics V (Numerical Methods and Computer Application)

Numerical differentiation

Forward, backward and central difference formulas, their errors, second derivatives, and choosing the step size.

Our notes

1 min read

Why differentiate numerically

When f is known only from data (displacement against time from a sensor) or is too complicated to differentiate by hand, derivatives are estimated from nearby values. Taylor series give the formulas and their errors.

First derivative formulas

  • Forward difference: f′(x) ≈ [f(x + h) − f(x)]/h, error about (h/2)f″: first order (error ∝ h).
  • Backward difference: f′(x) ≈ [f(x) − f(x − h)]/h, also first order.
  • Central difference: f′(x) ≈ [f(x + h) − f(x − h)]/(2h), error about (h²/6)f‴: second order (error ∝ h²).

Worked example. f(x) = eˣ at x = 1, h = 0.1 (true f′(1) = e = 2.718282). e^1.1 = 3.004166, e^0.9 = 2.459603.

  • Forward: (3.004166 − 2.718282)/0.1 = 2.858842, error 0.140560.
  • Central: (3.004166 − 2.459603)/0.2 = 2.722815, error 0.004533.

The central formula is about 30 times more accurate with the same points.

Second derivative

f″(x) ≈ [f(x + h) − 2f(x) + f(x − h)]/h², second order.
Same data: (3.004166 − 5.436564 + 2.459603)/0.01 = 0.027205/0.01 = 2.7205 (true 2.718282).

Choosing h

Smaller h cuts truncation error, but f(x + h) and f(x) become nearly equal and round-off (subtractive cancellation) grows like ε/h. For double precision with the central formula, h around 10⁻⁵ is a typical good choice; very small h (10⁻¹²) gives garbage.

Richardson extrapolation

Combine two estimates with step h and h/2 to cancel the leading error term. For a second-order formula: D ≈ [4D(h/2) − D(h)]/3, which is fourth order.

Noisy data

Differentiation magnifies noise. Smooth the data first (least squares fit or a moving average), or differentiate a fitted curve.

Exams usually ask: derive forward and central formulas from Taylor series; state their orders; compute derivative estimates from a table; explain the trade-off in choosing h.

Common mistake: dividing the central difference by h instead of 2h. The two points are 2h apart.

Written by the UniHive team in our own words. Spotted a mistake? Tell us on WhatsApp.

Read

Watch

We link to free material and never copy it. Every link was opened by our team before it went up; video data is a rough guide at 360p.

All ENG 303 topics

Report

Sign in to report this. It is free.

Is this your work (a lecturer, author or publisher)? Ask us to take it down.