正在加载图片...
END IMPLICIT RE REAL #8 K1.K2.K3 DIMENSION Y(20).,DY(20) DATA K1/0.0044/.K2/2.96/.K3/0.0021 K2*Y2-K3 Y(2) DY(3)=K2*Y(2 RETURN END SUBROUTINERK4(X0.Y0,Y.H.N.M) IMPLICIT REAL*8(A-H.O-Z) DIMENSION YO(N)Y(N) DIMENSION Y2(20).DY(20),RK(20) X=XO DO5I=1.N 5 Y(I)-YO(I) D050L=1,M CALL FCYDYY D010I=1N RK(I)-DY(I 10 Y20-Y00.5*H*DY CALL F(Y2,DY) D020I=1N RKOERKUH2DYOD Y20DEY(DH0 5*H*DYO) CALLF(Y2.DY) DO30I-I.N RK(I)=RK(I)+2◆DY(I 30 Y2I=Y④+HDYO CALL FCY2.DY) DO401=1N RK(D-RK(I)+DY( Y(IFY(I+RK(I)H/ 50 CONTINUE RETURN END END END SUBROUTINE F(Y,DY) IMPLICIT REAL *8(A-H,O-Z) REAL *8 K1,K2,K3 DIMENSION Y(20),DY(20) DATA K1/0.0044/,K2/2.96/,K3/0.0021/ DY(1)=-K1*Y(1)+K3*Y(2) DY(2)=K1*Y(1)-K2*Y(2)-K3*Y(2) DY(3)=K2*Y(2) RETURN END SUBROUTINE RK4(X0,Y0,Y,H,N,M) IMPLICIT REAL *8(A-H,O-Z) DIMENSION Y0(N),Y(N) DIMENSION Y2(20),DY(20),RK(20) X=X0 DO 5 I=1,N 5 Y(I)=Y0(I) DO 50 L=1,M CALL F(Y,DY) DO 10 I=1,N RK(I)=DY(I) 10 Y2(I)=Y(I)+0.5*H*DY(I) CALL F(Y2,DY) DO 20 I=1,N RK(I)=RK(I)+2*DY(I) 20 Y2(I)=Y(I)+0.5*H*DY(I) CALL F(Y2,DY) DO 30 I=1,N RK(I)=RK(I)+2*DY(I) 30 Y2(I)=Y(I)+H*DY(I) CALL F(Y2,DY) DO 40 I=1,N RK(I)=RK(I)+DY(I) 40 Y(I)=Y(I)+RK(I)*H/6 50 CONTINUE RETURN END END
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有