Last change
on this file since 526 was 286, checked in by harald, 25 years ago |
This is the start point for further developments of the Magic Monte Carlo
Simulation written by Jose Carlos Gonzales. Now it is under control of
one CVS repository for the whole collaboration. Everyone should use this
CVS repository for further developments.
|
File size:
1.2 KB
|
Line | |
---|
1 | DOUBLE PRECISION FUNCTION GAM( Z )
|
---|
2 |
|
---|
3 | C-----------------------------------------------------------------------
|
---|
4 | C GAM(MA FUNCTION)
|
---|
5 | C
|
---|
6 | C EULER'S GAMMA FUNCTION
|
---|
7 | C THE INTERNAL PRECISION OF THIS FUNCTION IS ONLY SINGLE PRECISION.
|
---|
8 | C THIS FUNCION IS CALLED FROM NKG
|
---|
9 | C ARGUMENT:
|
---|
10 | C Z = ARGUMENT OF GAMMA FUNCTION (0 < Z < 57)
|
---|
11 | C-----------------------------------------------------------------------
|
---|
12 |
|
---|
13 | IMPLICIT NONE
|
---|
14 |
|
---|
15 | DOUBLE PRECISION U,Y,YY,Z
|
---|
16 | C-----------------------------------------------------------------------
|
---|
17 |
|
---|
18 | C CALCULATE CORRESPONDING FUNCTION VALUE IN INTERVAL 1 ... 2
|
---|
19 | Y = MOD(Z,1.D0)
|
---|
20 | YY = Y + 1.D0
|
---|
21 |
|
---|
22 | C PARAMETRIZATION FOR VALUES IN INTERVAL 1 ... 2
|
---|
23 | GAM = 1.D0 + Y*(-0.5771017D0 + Y*(0.9858540D0+
|
---|
24 | * Y*(-0.8764218D0 + Y*(0.8328212D0+
|
---|
25 | * Y*(-0.5684729D0 + Y*(0.2548205D0+
|
---|
26 | * Y*(-0.0514993D0 )))))))
|
---|
27 |
|
---|
28 | C GET FUNCTION VALUE IN DESIRED INTERVAL BY ITERATION
|
---|
29 | IF ( Z .LT. 1.D0 ) THEN
|
---|
30 | C GAMMA(Z-1) IS GAMMA(Z) / (Z-1)
|
---|
31 | GAM = GAM / Z
|
---|
32 | ELSE
|
---|
33 | C GAMMA(Z+1) IS GAMMA(Z) * Z
|
---|
34 | DO 1 U = YY, Z-1.D0, 1.D0
|
---|
35 | GAM = GAM * U
|
---|
36 | 1 CONTINUE
|
---|
37 | ENDIF
|
---|
38 |
|
---|
39 | RETURN
|
---|
40 | END
|
---|
Note:
See
TracBrowser
for help on using the repository browser.