Lab 19 · Lecture 19 · Numerical Differentiation
Numerical Differentiation Lab
Compare difference formulas, find the best step size, use Richardson extrapolation, and check a machine-learning gradient.
Type any f(x) and point x₀, then move the step h. The table compares forward, backward, central, Richardson and the second-derivative formula with the exact derivative.
The difference table of the robot data. Read the diagonal for the point you need.
Table derivatives and Richardson
Try this
Gradient checking
Try this
Q1 Derive the central-difference formula for and its error.
Taylor: . Subtract: , so : error .
Q2 Write the formulas for and at from Newton's forward formula.
, .
Q3 Why is numerical differentiation called ill-conditioned?
It divides small differences of data by small steps: a data error produces a derivative error of about (first derivative) or (second). Smaller reduces truncation error but magnifies noise and round-off.
Q4 Use Richardson extrapolation: , for at 1.
; true value .
Q5 What is gradient checking?
Comparing a gradient computed analytically (e.g. by backpropagation) with central-difference estimates for a few parameters; a relative difference around or smaller means the gradient code is correct.