|
OPTION ARITHMETIC COMPLEX
FOR Z=1 TO 100
LET XX=Z
FOR I=1 TO 20
LET X=XX !'初期値
LET XX=X-IM(ZETA(COMPLEX(.5,X))/DF(COMPLEX(.5,X))) !'ニュートン法
IF ABS(XX-X)<1E-13 THEN EXIT FOR
NEXT I
IF ABS(OLDXX-XX)>1E-7 AND ABS(ZETA(COMPLEX(.5,XX)))<1E-7 THEN !'前回と違うなら
PRINT ".5+";STR$(XX);"i"
LET OLDXX=XX
END IF
NEXT Z
END
EXTERNAL FUNCTION DF(X) !'数値微分
OPTION ARITHMETIC COMPLEX
LET H=1/128
LET DF=(ZETA(X+H)-ZETA(X))/H
END FUNCTION
EXTERNAL FUNCTION ZETA(S) !'ゼータ関数
OPTION ARITHMETIC COMPLEX
FOR M=1 TO 600
LET SS=0
FOR J=1 TO M
LET SS=SS+(-1)^(J-1)*COMB(M-1,J-1)*J^(-S)
NEXT J
LET SUM=SUM+SS*2^(-M)
IF ABS(SUM-S0)<1E-14 THEN
LET ZETA=SUM/(1-2^(1-S))
EXIT FUNCTION
END IF
LET S0=SUM
NEXT M
PRINT "収束エラー"
STOP
END FUNCTION
|
|