Forward, backward and central differences for derivatives

Linear electrical circuits consist of resistors, capacitors, inductors, and voltage
and current sources. Let us consider here a simple resistor-inductor (RL)
one-port network driven by a current source. When a current *I = I(t)* is
applied to the input port, the voltage *V = V(t)* develops
across the port terminals. The voltage output *V(t)* can be determined as a sum of
the voltage drop across the resistor (which is *R I(t)* from the Ohm's law)
and of the voltage drop across the inductor (which is *L I'(t)*, where
*I'(t)* denotes the derivative of *I(t)*). Suppose the input
current *I(t)* can be measured (detected) at different times *t = t _{k}*
and it is generated by the following oscillatory and decaying signal
(click to enlarge the image):

The output voltage *V(t) = R I(t) + L I'(t)* can be computed
at the times *t = t _{k}*
only if the derivative

Let us denote the current time instance as *t = t _{0}*, when the current
is

Consider a linear interpolation between the current data value
(*t _{0},I_{0}*) and the future data value
(

I'(t_{0}) = (I_{1}-I_{0}) / (t_{1} - t_{0})

Forward differences are useful in solving ordinary differential equations
by single-step predictor-corrector methods (such as Euler and Runge-Kutta methods).
For instance, the forward difference above predicts the value of *I _{1}*
from the derivative

Consider a linear interpolation between the current data value
(*t _{0},I_{0}*) and the past data value
(

I'(t_{0}) = (I_{0}-I_{-1}) / (t_{0} - t_{-1})

Backward differences are useful for approximating the derivatives if
data in the future are not yet available. Moreover, data in the future
may depend on the derivatives approximated from the data in the past
(such as in control problems). If the data values are equally spaced
with the step size *h*, the truncation error of the backward difference
approximation has the order of *O(h)* (as bad as the forward difference
approximation).

Finally, consider a linear interpolation between the past data value
(*t _{-1},I_{-1}*) and the future data value
(

I'(t_{0}) = (I_{1}-I_{-1}) / (t_{1} - t_{-1})

If the data values are equally spaced, the central difference is an average
of the forward and backward differences. The truncation error of the central
difference approximation is order of *O(h ^{2})*, where

- Errors of the difference approximations for derivatives
- Presents graphs of numerical derivatives for the data values above