相关代码 |
|
Sub GSER(GAMSER, A, X, GLN) ITMAX = 100 EPS = 0.0000003 GLN = GAMMLN(A) If X If X < 0# Then Print " PAUSE" Exit Sub End If GAMSER = 0# Exit Sub End If AP = A Sum = 1# / A DEL = Sum For N = 1 To ITMAX AP = AP + 1# DEL = DEL * X / AP Sum = Sum + DEL If Abs(DEL) < Abs(Sum) * EPS Then GoTo 1 Next N Print "A too large, ITMAX too small" 1 GAMSER = Sum * Exp(-X + A * Log(X) - GLN) End Sub
相关资源 |
|