The derivative of a given function can be approximated by
the forward difference based on a step size
:
(1) |
(3) |
The derivative of can also be approximated by the
backward difference. Replacing
by
in the Taylor
expansion above, we get
(5) |
We can also find the central difference by subtracting
Eq. (4) from Eq. (2), and
dividing both sides by to get
Moreover, if we add Eqs. (2) and (4)
and solve the resulting equation for , we get an approximation
of the second order derivative: