As another practical example of the use of the template file approach, consider writing a general program for solving a system of equations of the form:
using Newton's method [32]. A bold typeface is again used to denote a vector.
The system of iterates can be written as:
where denotes the Jacobian matrix and is a given set of initial values used to start the iteration process. denotes the inverse of and the superscript denotes evaluation at iterate . The iterative process is continued until some stopping criteria are satisfied at iteration itmax. When the system to be solved is scalar valued, is simply the reciprocal of . For practical implementation, () is rewritten at each iteration as:
where satisfies
The linear system () is typically solved using LU decomposition of the Jacobian matrix at each iteration. The value of thus obtained is substituted into () to obtain .