|
!' ハリー無理法
PUBLIC NUMERIC T
INPUT PROMPT "X=":T
LET EPS=1E-8
LET XX=T
DO
LET X=XX
LET H=DF(X)^2-2*F(X)*DF2(X)
IF H>0 THEN
LET XX=X-(DF(X)-SQR(H))/DF2(X)
ELSE
LET XX=X-DF(X)/DF2(X)
END IF
PRINT XX
LOOP UNTIL ABS(XX-X)<EPS
PRINT XX;XX^3
END
EXTERNAL FUNCTION F(X)
LET F=X*X*X-T
END FUNCTION
EXTERNAL FUNCTION DF(X)
LET DF=3*X*X
END FUNCTION
EXTERNAL FUNCTION DF2(X)
LET DF2=6*X
END FUNCTION
|
|