source: trunk/MagicSoft/Simulation/Corsika/Mmcs/gam.f@ 18679

Last change on this file since 18679 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
3C-----------------------------------------------------------------------
4C GAM(MA FUNCTION)
5C
6C EULER'S GAMMA FUNCTION
7C THE INTERNAL PRECISION OF THIS FUNCTION IS ONLY SINGLE PRECISION.
8C THIS FUNCION IS CALLED FROM NKG
9C ARGUMENT:
10C Z = ARGUMENT OF GAMMA FUNCTION (0 < Z < 57)
11C-----------------------------------------------------------------------
12
13 IMPLICIT NONE
14
15 DOUBLE PRECISION U,Y,YY,Z
16C-----------------------------------------------------------------------
17
18C CALCULATE CORRESPONDING FUNCTION VALUE IN INTERVAL 1 ... 2
19 Y = MOD(Z,1.D0)
20 YY = Y + 1.D0
21
22C 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
28C GET FUNCTION VALUE IN DESIRED INTERVAL BY ITERATION
29 IF ( Z .LT. 1.D0 ) THEN
30C GAMMA(Z-1) IS GAMMA(Z) / (Z-1)
31 GAM = GAM / Z
32 ELSE
33C 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.