next up previous
Next: Use of global variables Up: Finite difference methods for Previous: The fourth order Runge

The routine runge

The routine runge is a simple Runge-Kutta stepper. It does not incorporate accuracy estimates or step size adjustment.

The call to runge is

runge (n, h, t, y, der)

n (int) is the number of ODE's

h (float) is the time step

t (float) is time at the start of the step

y ( float array) is the array of dependent variables at time t and is modified to be the array of dependent variables at time t+h.

der is the name of a subroutine that will calculate the derivatives of y (the tex2html_wrap_inline285 above). der will be called by runge. You must write this subroutine. It is in this subroutine that the form of ODE's is specified.

Each call to runge advances the solutions y by a step h in time, provided your der correctly specifies the ODE's.

The call to der must be as follows:

der (t, y, dydt)

t (float) is current time

y (float array) is the solution as above

dydt (float array of derivatives of y at time t (this is how the ODE's are specified)).



Keith Jones
Sun Jan 23 14:17:38 EST 2000