ガウス・ラゲール求積

 投稿者:しばっち  投稿日:2015年10月 3日(土)22時31分4秒
 
!'/∞
!'| f(x)dx*exp(b*(x-a))/(x-a)^α  (α>-1)
!'/a
LET N=8
LET EPS=1E-12
DIM XX(N),WW(N)
LET H=1/N
LET ALPHA=2 !'整数のみ
PRINT "          零点                重み"
FOR X=0 TO 50 STEP H
   IF L(N,ALPHA,X)*L(N,ALPHA,X+H)<0 THEN
      LET A=X
      LET B=X+H
      DO
         LET C=(A+B)/2
         IF L(N,ALPHA,A)*L(N,ALPHA,C)<0 THEN LET B=C ELSE LET A=C
      LOOP UNTIL ABS(A-B)<EPS
      LET I=I+1
      LET XX(I)=C
      LET WW(I)=WEIGHT(N,ALPHA,C)
      PRINT I;":";XX(I);WW(I)
   END IF
NEXT  X
LET A=0
INPUT PROMPT "GAMMA(X) X=":U
FOR I=1 TO N
   LET  S=S+WW(I)*F(XX(I),U)*EXP(XX(I)-A)/(XX(I)-A)^ALPHA
NEXT I
PRINT S
END

EXTERNAL  FUNCTION F(U,X)
LET  F=EXP(-U)*U^(X-1)
END FUNCTION

EXTERNAL FUNCTION L(N,A,X) !'ラゲール陪関数
LET OLDLL=1
LET LL=A+1-X
FOR K=1 TO N-1
   LET NEWLL=((2*K+1+A-X)*LL-(K+A)*OLDLL)/(K+1)
   LET OLDLL=LL
   LET LL=NEWLL
NEXT  K
LET L=NEWLL
END FUNCTION

EXTERNAL FUNCTION WEIGHT(N,A,X)
LET WEIGHT=FACT(N+A)*X/FACT(N)/((N+1)*L(N+1,A,X))^2
END FUNCTION
 

戻る