|
!' ハリー法(HALLEY法)
PUBLIC NUMERIC T
INPUT PROMPT "X=":T
LET EPS=1E-8
LET X=T
DO
LET X=X-H(X)/DH(X)
PRINT X
LOOP UNTIL ABS(F(X))<EPS
PRINT X;X^3
END
EXTERNAL FUNCTION H(X)
LET H=F(X)/SQR(DF(X))
END FUNCTION
EXTERNAL FUNCTION DH(X)
LET DH=SQR(DF(X))-F(X)*DF2(X)/(2*DF(X)*SQR(DF(X)))
END FUNCTION
EXTERNAL FUNCTION F(X)!' f(x)
LET F=X^3-T
END FUNCTION
EXTERNAL FUNCTION DF(X)!' f'(x)
LET DF=3*X^2
END FUNCTION
EXTERNAL FUNCTION DF2(X)!' f''(x)
LET DF2=6*X
END FUNCTION
|
|