lit
    JINRLIB

DRKSTP - -

D209

: G.A.Erskine :

popa o ppoa cc n >= 1 coc pa pa poo opa

dyi/dx = fi(x,y1 ,y2 ,...,yn), i=1,2,...,n

ooo aa h aco po x.

:

: - SUBROUTINE
: - DRKSTP
: - SUB - /

:

CALL DRKSTP(N,H,X,Y,SUB,W), :

N - (INTEGER) oco pa cc;
H - (REAL*8) a ppoa h;
X - (REAL*8) a o - aao a aco po x, a o - x+h;
Y - (REAL*8) oop acc papoc N,
a o Y(I) (I=1,2,...,N) yi(x),
a o - yi(x+h);
W - (REAL*8) pao acc papoc N*3;
SUB - ooa, ocao EXTERNAL a popa.
SUB oa :
SUBROUTINE SUB(X,Y,F), :
   X - (REAL*8) aca pa,
   Y,F - (REAL*8) oop acc, Y(*), F(*).
c a pa ac
p pa:
F(I) = fI(X,Y(1),...,Y(N)), I=1,2,...,N.

:

coc o P-a poo opa:

k1 = h*f(x,y(x))
k2 = h*f(x+h/2, y(x)+k1/2)
k3 = h*f(x+h/2, y(x)+k2/2)
k4 = h*f(x+h, y(x)+k3)
y(x+h) = y(x) + (1/6)*(k1 +2*k2 +2*k3 +k4)

:

op a y(x+h) c ooc o h5.

:

c N<1, o coo o o.

:

  1. ..M, ,
    , 1955.
  2. F.B.Hildebrand, Introduction to numerical analysis
    (McGraw-Hill, New-York, 1956), Section 6.16.
:

pp p p p
p x=0, y1=y2=y3=0, h=0.1:

dy1/dx = x2*(3*sinx+x*cosx)
dy2/dx = x2*(6*cosx-x*sinx)+6x*sinx
dy3/dx = - x2*(x*cosx+9*sinx)+18x*cosx+6*sinx
       IMPLICIT REAL*8 (A-H,O-Z)
       EXTERNAL SUB
       DIMENSION Y(3),W(3,3)
       DATA H/0.1/
       DO 6 L=1,3
    6  Y(L)=0.D0
       X=0.D0
       WRITE(*,10)
       CALL DRKSTP(3,H,X,Y,SUB,W)
       WRITE(*,2) X,Y
       Y(1)=X**3*DSIN(X)
       Y(2)=X**2*(3*DSIN(X)+X*DCOS(X))
       Y(3)=X**2*(6*DCOS(X)-X*DSIN(X))+6*X*DSIN(X)
       WRITE(*,3)
       WRITE(*,2) X,Y
    2  FORMAT(' ',D7.2,3D18.10)
    3  FORMAT(' ',15X,'ANALYTIC SOLUTION')
    10 FORMAT('     X',11X,'Y(1)',14X,'Y(2)',14X,'Y(3)')
       END
 
       SUBROUTINE SUB(X,Y,F)
       IMPLICIT REAL*8 (A-H,O-Z)
       DIMENSION Y(*),F(*)
       F(1)=X**2*(3*DSIN(X)+X*DCOS(X))
       F(2)=X**2*(6*DCOS(X)-X*DSIN(X))+6*X*DSIN(X)
       F(3)=-X**2*(X*DCOS(X)+9*DSIN(X))+18*X*DCOS(X)+6*DSIN(X)
       RETURN
       END
:
           X           Y(1)              Y(2)              Y(3)
       .10D+00   .9981261455D-04   .3989591594D-02   .1190005248D+00
                      ANALYTIC SOLUTION
       .10D+00   .9983341665D-04   .3990006665D-02   .1190004665D+00


home up e-mail