INTERFACE RKF4Integrator; IMPORT Integrator; FROM Integrator IMPORT DiffProc, Time, State, Velocity, Error; TYPE T <: Public; (* An adaptive Runge-Kutta integrator for ordinary differential equations. The "integrate" method performs one or more chained steps of the Runge-Kutta-Fehlberg method, which is theoretically accurate to fourth order. The time step is automatically chosen at each step, as specified by the client "checkStep" and "checkState" procedures. The error estimate at each step is the difference between the fourth- and fifth-order Runge-Kutta approximators. Created 95/06 by R.L.Liesenfeld, C.H.Q.Forster, and J.Stolfi *) Public = Integrator.T OBJECT METHODS END; PROCEDURE Step( diff: DiffProc; (* Differential formula *) ta: Time; (* Initial time *) READONLY sa: State; (* Initial state *) READONLY va: Velocity; (* Initial velocity *) tb: Time; (* Final time *) VAR sb: State; (* (Out) Final state *) VAR er: Error; (* (Out) Error estimate *) VAR v2, v3, v4, v5, v6: Velocity; (* Work areas *) ); (* Performs a single step of the Runge-Kutta-Fehlberg integrator, which computes a degree four approximation to the system's path from state "sa" at time "ta" to state "sb" at time "tb". The procedure must be given the velocity "va" at "sa", already computed. The estimated error is returned in "er". *) END RKF4Integrator.