|
!' y'=F(x,y)
OPTION BASE 0
LET XS=0 !' XS~XEまで
LET XE=1
LET X=XS
LET Y=1 !'初期値
LET N=8 !'分割数
LET H=(XE-XS)/N
DIM XX(N),YY(N),A(N)
LET K1=F(X,Y)
LET K2=F(X+H/2,Y+H/2*K1)
LET K3=F(X+H/2,Y+H/2*K2)
LET K4=F(X+H,Y+H*K3)
LET Y1=Y+H*(K1+2*K2+2*K3+K4)/6
LET X1=X+H
LET K1=F(X1,Y1)
LET K2=F(X1+H/2,Y1+H/2*K1)
LET K3=F(X1+H/2,Y1+H/2*K2)
LET K4=F(X1+H,Y1+H*K3)
LET Y2=Y1+H*(K1+2*K2+2*K3+K4)/6
LET X2=X1+H
LET K1=F(X2,Y2)
LET K2=F(X2+H/2,Y2+H/2*K1)
LET K3=F(X2+H/2,Y2+H/2*K2)
LET K4=F(X2+H,Y2+H*K3)
LET Y3=Y2+H*(K1+2*K2+2*K3+K4)/6
LET X3=X2+H
FOR I=1 TO N
LET K1=F(X3,Y3)
LET K2=F(X3+H/2,Y3+H/2*K1)
LET K3=F(X3+H/2,Y3+H/2*K2)
LET K4=F(X3+H,Y3+H*K3)
LET Y4=Y3+H*(K1+2*K2+2*K3+K4)/6
LET X4=X3+H
LET Y5=Y4+H/720*(251*F(X4,Y4)+646*F(X3,Y3)-264*F(X2,Y2)+106*F(X1,Y1)-19*F(X,Y))
LET X5=X4+H
LET X=X1
LET Y=Y1
LET X1=X2
LET Y1=Y2
LET X2=X3
LET Y2=Y3
LET X3=X4
LET Y3=Y4
LET X4=X5
LET Y4=Y5
LET XX(I)=X
LET YY(I)=Y
PRINT X;Y;EXP(X)
NEXT I
CALL CALC(N,XX,YY,A)
CALL DISPLAY(N-1,A)
END
EXTERNAL FUNCTION F(X,Y) !' y'=f(x,y)
LET F=Y
END FUNCTION
以下略
EXTERNAL SUB CALC(N,XX(),YY(),A())
END SUB
EXTERNAL SUB DISPLAY(N,A())
END SUB
EXTERNAL FUNCTION NUM(X)
END FUNCTION
|
|