Differentiation with a Computer
- The derivative of a function, at , is defined as
- This is called a forward-difference approximation.
- The limit could be approached from the opposite direction, giving a backward-difference approximation.
- Forward-difference approximation. A computer can calculate an approximation to the derivative, if a very small value is used for .
- Recalculating with smaller and smaller values of starting from an initial value.
- What happens if the value is not small enough?
Table 1:
Forward-difference approximations for
.
|
With MATLAB. Analytical answer to the function of Table 1.
With MATLAB. Numerical answer to the function of Table 1.
With MATLAB,
Table 2 illustrates this, showing that errors decrease about four fold when is halved (as Eq. 3 predicts) and that a more accurate value is obtained.
Table 2:
Central-difference approximations for
.
|
Cem Ozdogan
2011-01-05