Finite differences: numerical derivatives
5 min read
Short answer
Forward: (error ). Central: (error ). Central differences are far more accurate for the same , but making too small amplifies round-off error.
Where the errors come from
Taylor: . Solving for in the forward formula leaves as the error. In the central formula the terms cancel, leaving .
The round-off trap
Truncation error falls as shrinks, but subtracting nearly equal numbers loses digits, so round-off error grows like . The total error is smallest at an intermediate (about for forward differences in double precision).
Worked example
Estimate for with using forward and central differences. The exact value is .
, , . Forward: (error ). Central: (error ).
Try it yourself
What second-derivative formula uses , and ?
Show the answer
(second-order accurate).
Keep going with practice
Vidi's differential-equation lessons use finite differences to turn PDEs into solvable linear systems.