next up previous index
Next: D300 Elliptic Partial Up: CERNLIB Previous: D202 First-order Differential

D203 Second-order Differential Equations (Runge--Kutta--Nyström)

Routine ID: D203
Author(s): Library: MATHLIB
Submitter: Submitted: 07.06.1992
Language: FortranRevised: 01.12.1994

Subroutine subprograms RRKNYS and DRKNYS advance the solution of the system of n ≥1 simultaneous second-order differential equations

{d2yidx2} = fi(x,y1,...,yn,y'1,...,y'n), (i = 1,2,...,n)

where y'i= dyi/dx , by a single step of length h in the independent variable x.

On computers other than CDC or Cray, only the double-precision version DRKNYS is available. On CDC and Cray computers, only the single-precision version RRKNYS is available.

Structure:

SUBROUTINE subprograms
User Entry Names : RRKNYS, DRKNYS
Obsolete User Entry Names: RKNYS RRKNYS
External References: User-supplied SUBROUTINE subprogram

Usage:

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

    CALL tRKNYS(N,H,X,Y,YP,SUB,W)
N
( INTEGER) Number n of equations.
H
(type according to t) The step-length h.
X
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) .
YP
(type according to t) One-dimensional array of length ≥N . On entry, YP(i),(i=1,...,N) , must contain y'i(x) . On exit, YP(i),(i=1,...,N) , contains approximate values y'i(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 6*N elements required as working-space.
The user-supplied subroutine SUB should be of the form
    SUBROUTINE SUB(X,Y,YP,F)
where the variable X and the one-dimensional arrays Y(*), YP(*) and F(*) are of type t. This subroutine must set

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

Method:

Using boldface quantities to denote vectors of length n, the computational sequence is as follows:
k1 = {12}h2f(x,y(x),y'(x))

k2 = {12}h2 f(x+{12}h,y(x)+{12}hy'(x)+{14}k1,y'(x)+{1h}k1)

k3 = {12}h2 f(x+{12}h,y(x)+{12}hy'(x)+{14}k1,y'(x)+{1h}k2)

k4 = {12}h2 f(x+h,y(x)+hy'(x)+k3,y'(x)+{2h}k3)

y(x+h) = y(x)+hy'(x)+{13}(k1+ k2+ k3)

y'(x+h) = y'(x)+{13h}(k1+ 2k2+ 2k3+k4)

The error per step is proportional to h5 .

Error handling:

For N ≤0 or H=0 , control is returned to the calling program without any change in Y or YP.

References:

  1. L. Collatz, The numerical treatment of differential equations, (Springer-Verlag Berlin 1960) 537

D300



next up previous index
Next: D300 Elliptic Partial Up: CERNLIB Previous: D202 First-order Differential


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