|
二重階乗
OPTION ARITHMETIC COMPLEX
FOR I=1 TO 10
LET X=COMPLEX(I,0)
PRINT X;"!!=";(2/PI)^((1-CCOS(PI*X))/4)*2^(X/2)*GAMMA(1+X/2)
NEXT I
END
EXTERNAL FUNCTION CCOS(Z) !'cosine
OPTION ARITHMETIC COMPLEX
LET X=RE(Z)
LET Y=IM(Z)
LET XR=COS(X)*COSH(Y)
LET XI=-SIN(X)*SINH(Y)
LET CCOS=COMPLEX(XR,XI)
END FUNCTION
EXTERNAL FUNCTION GAMMA(X) !'ガンマ関数
OPTION ARITHMETIC COMPLEX
LET GAMMA=EXP(LOGGAMMA(X))
END FUNCTION
EXTERNAL FUNCTION LOGGAMMA(X)
OPTION ARITHMETIC COMPLEX
LET S=(X-.5)*LOG(X)-X+LOG(2*PI)/2
LET A=1/X
FOR N=1 TO 5
LET S=S+BERNOULLI(2*N)/(2*N)/(2*N-1)*A
LET A=A/X/X
NEXT N
LET LOGGAMMA=S
END FUNCTION
EXTERNAL FUNCTION BERNOULLI(K) !'ベルヌーイ数
OPTION ARITHMETIC COMPLEX
LET S=1
LET C=K+1
FOR N=2 TO K+1
LET C=C*(N-K-2)/N
LET H=H+C*S/N
LET S=S+N^K
NEXT N
LET BERNOULLI=H
END FUNCTION
----------------------------------------------------------
OPTION ARITHMETIC RATIONAL
LET M=2
FOR N=0 TO 50
LET A=1
FOR I=N TO 1 STEP -M
LET A=A*I
NEXT I
PRINT STR$(N);REPEAT$("!",M);" : ";A
NEXT N
END
|
|