In: Math
What's the difference between numerical method to
calculate differential (backward, central, forward)? At what
condition do I have to use forward over central and backward, etc?
If there's boundary condition that permits the complete use of
central method, what will happen if I still use forward, backward,
and central regardless there's boundary condition that permits the
use of central method?
note: I'm not used to describe pure mathematical problem in
english, so I'm sorry if my question is hard to understand. feel
free to add comment under this question and I'll explain it again,
hopefully in clearer manner. thank you
Forward difference
Consider a linear interpolation between the current data value (t0,I0) and the future data value (t1,I1). The slope of the secant line between these two points approximates the derivative by the forward (two-point) difference:
I'(t0) = (I1-I0) / (t1 - t0)
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 I1 from the derivative I'(t0) and from the value I0. If the data values are equally spaced with the step size h, the truncation error of the forward difference approximation has the order of O(h).
Backward difference
Consider a linear interpolation between the current data value (t0,I0) and the past data value (t-1,I-1). The slope of the secant line between these two points approximates the derivative by the backward (two-point) difference:
I'(t0) = (I0-I-1) / (t0 - 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).
Central difference
Finally, consider a linear interpolation between the past data value (t-1,I-1) and the future data value (t1,I1). The slope of the secant line between these two points approximates the derivative by the central (three-point) difference:
I'(t0) = (I1-I-1) / (t1 - 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(h2), where h is the step size. It is clear that the central difference gives a much more accurate approximation of the derivative compared to the forward and backward differences. Central differences are useful in solving partial differential equations. If the data values are available both in the past and in the future, the numerical derivative should be approximated by the central difference.