next up previous contents
Next: Hamiltonian systems Up: Splice and template files Previous: Combining code

A generalised Runge-Kutta subroutine

Consider the problem of writing a general subroutine for a Runge-Kutta scheme [13] for a system of ordinary differential equations. The convention of writing an m-dimensional vector in a bold typeface is adopted.

The general s-stage Runge-Kutta method for the initial-value problem  
 \begin{displaymath}
{\bf y}'={\bf f}(x,{\bf y}),\quad {\bf y}(\alpha) = {\bmit \eta
},\quad {\bf f} : \real \times \real^{m} \mapsto \real^{m} \,,\end{displaymath} (1)
is defined by

\begin{displaymath}
{\bf y}_{n+1} = {\bf y}_n + h \sum_{i=1}^s b_i \, {\bf k}_i \,,\end{displaymath}

where

\begin{displaymath}
{\bf k}_i = {\bf f}(x_n+c_i \, h,{\bf y}_n + h \sum_{j=1}^s a_{ij} \, {\bf
k}_j),\quad i = 1,\ldots,s \,,\end{displaymath}

and the row-sum conditions

\begin{displaymath}
c_i =\sum_{j=1}^s a_{ij} \,,\end{displaymath}

are usually assumed to hold. Furthermore, if aij = 0 for $j\ge i$, $i = 1,\ldots,s$ then the method is said to be an explicit or classical Runge-Kutta scheme and the ${\bf k}_i$ can be calculated by a straightforward recursion.

Structural information for a problem, should invariably be exploited in a symbolic system, since the resulting performance gains can be significant [4]. The same techniques should be applied when creating a general template file. A lot of the tedium can be removed from the analysis of a large number of problems and greater throughput is enabled. The next section contains such an example.



 

Jorge Romao
5/14/1998