Next: Evaluating the Jacobian matrix analytically
Up: Splice and template files
Previous: Extension to non-autonomous Hamiltonian systems
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:
| ![\begin{displaymath}
{\bf f}({\bf x})={\bf 0}\end{displaymath}](img30.gif) |
(2) |
using Newton's method [32]. A bold typeface is again used to
denote a vector.
The system of iterates can be written as:
| ![\begin{displaymath}
{\bf x}^{(i)} = {\bf x}^{(i-1)} - ({J^{(i-1)}})^{-1} \, {\bf f}^{(i-1)} \quad ,
\quad i = 1,\ldots,itmax\end{displaymath}](img31.gif) |
(3) |
where
denotes the
Jacobian matrix and
is a given set of initial values used to start
the iteration process. (Jk)-1 denotes the inverse of J(k) and the
superscript k 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, (Jk)-1 is
simply the reciprocal of Jk. For practical implementation,
(3) is rewritten at each iteration as:
| ![\begin{displaymath}
{\bf x}^{(i)} ={\bf x}^{(i-1)} - {\bf y}^{(i-1)}\end{displaymath}](img35.gif) |
(4) |
where
satisfies
| ![\begin{displaymath}
J^{(i-1)} \, {\bf y}^{(i-1)} = {\bf f}^{(i-1)} \,.\end{displaymath}](img37.gif) |
(5) |
The linear system (5) is typically
solved using LU decomposition of the Jacobian matrix at each iteration. The
value of
thus obtained is substituted into (4)
to obtain
.
Next: Evaluating the Jacobian matrix analytically
Up: Splice and template files
Previous: Extension to non-autonomous Hamiltonian systems
Jorge Romao
5/14/1998