|
!' エイトケン法(AITKEN法)
PUBLIC NUMERIC T
INPUT PROMPT "X=": T
LET EPS=1E-8
LET X0 = T
DO WHILE ABS(F(X0) - X0) > EPS
LET X1 = F(X0)
LET X2 = F(X1)
LET X3 = X0 - (X1 - X0) * (X1 - X0) / (X2 - 2 * X1 + X0)
LET X0 = X3
PRINT X0
LOOP
PRINT X0;X0*X0
END
EXTERNAL FUNCTION F(X) !' X=F(X) F(X)-X=0
LET F=X * X + X - T
END FUNCTION
|
|