|
!' 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
FOR I=1 TO N
LET Y3=Y2+H/12*(23*F(X2,Y2)-16*F(X1,Y1)+5*F(X,Y))
LET X3=X2+H
LET X=X1
LET Y=Y1
LET X1=X2
LET Y1=Y2
LET X2=X3
LET Y2=Y3
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
|
|