|
!' オストロフスキー法(OSTROWSKI法)
PUBLIC NUMERIC T
INPUT PROMPT "X=": T
LET X0=T
LET X2=1
LET X1=(X0+X2)/2
LET EPS=1E-8
DO
LET TT=(X2-X1)/(X2-X0)*(F(X2)-F(X0))/(F(X2)-F(X1))*F(X1)/F(X0)
LET X3=(X1-X0*TT)/(1-TT)
LET X0=X1
LET X1=X2
LET X2=X3
PRINT X3
LOOP UNTIL ABS(F(X3))<EPS
PRINT X3;X3*X3
END
EXTERNAL FUNCTION F(X)
LET F=X*X-T
END FUNCTION
|
|