next up previous index
Next: D201 First-order Differential Up: CERNLIB Previous: D114 Adaptive Multidimensional

D200 First-order Differential Equations (Runge--Kutta)

Routine ID: D200
Author(s): Library: MATHLIB
Submitter: Submitted: 01.09.1983
Language: FortranRevised: 01.03.1994

Subroutine subprograms RRKSTP and DRKSTP advance the solution of the system of n ≥1 simultaneous first-order differential equations

{dyidx} = fi(x,y1,...,yn), (i = 1,2,...,n)

by a single step of length h in the independent variable x.

On CDC and Cray computers, the double-precision version DRKSTP is not available.

Structure:

SUBROUTINE subprograms
User Entry Names : RKSTP, DRKSTP
Obsolete User Entry Names : RKSTP RRKSTP
Files Referenced : Unit 6
External References: user-supplied SUBROUTINE subprogram

Usage:

For t=R (type REAL), t=D (type DOUBLE PRECISION),

    CALL tRKSTP(N,H,X,Y,SUB,W)
N
( INTEGER) Number n of equations.
H
(type according to t) The step-length h.
X
(type according to t) On entry, X must be equal to the initial value of the independent variable x. On exit, X is equal to x+h.
Y
(type according to t) One-dimensional array of length N. On entry, Y(i),(i=1,...,N) , must contain yi(x) . On exit, Y(i),(i=1,...,N) , contains approximate values yi(x+h) .
SUB
Name of a user-supplied SUBROUTINE subprogram, declared EXTERNAL in the calling program.
W
(type according to t) Array containing at least 3*N elements required as working-space.
The user-supplied subroutine SUB should be of the form
    SUBROUTINE SUB(X,Y,F)
where the variable X and the one-dimensional arrays Y(*) and F(*) are of type t. This subroutine must set

F(I)= fI(X,Y(1),...,Y(N))(I = 1,2,...,N).

Method:

Using boldface quantities to denote vectors of length n, the computational sequence is as follows:
k1 = h f(x,y(x)),

k2 = h f(x+{12}h,y(x)+{12}k1),

k3 = h f(x+{12}h,y(x)+{12}k2),

k4 = h f(x+h,y(x)+k3); y(x+h) = y(x)+{16}(k1+ 2k2+ 2k3+ k4)

The error per step is proportional to h5 .

Error handling:

N < 1 acts as do nothing.

References:

  1. F.B. Hildebrand, Introduction to numerical analysis, (McGraw-Hill, New--York 1956) Sect. 6.16.

D201

K.S. Kölbig



next up previous index
Next: D201 First-order Differential Up: CERNLIB Previous: D114 Adaptive Multidimensional


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995