|
!' 逐次代入法
!'(X+1)^2=T
!'X^2+2*X=T-1
!'X*(X+2)=T-1
!'X=(T-1)/(X+2)
PUBLIC NUMERIC T,N
INPUT PROMPT "n乗根=":N
INPUT PROMPT "X=": T
LET EPS=1E-8
LET XX = T
DO
LET X=XX
LET XX = F(X)
PRINT XX + 1
LOOP UNTIL ABS(X-XX)<EPS
PRINT XX + 1;(XX+1)^N
END
EXTERNAL FUNCTION F(X)
!'LET F=(T-1)/(X+2)
!'LET F=(T-1)/(X^2+3*X+3)
!'LET F=(T-1)/(X^3+4*X^2+6*X+4)
!'LET F=(T-1)/(X^4+5*X^3+10*X^2+10*X+5)
!'LET F=(T-1)/(((X+1)^N)/X-1/X)
FOR I=0 TO N-1
LET S=S*X+COMB(N,I)
NEXT I
LET F=(T-1)/S
END FUNCTION
|
|