COSMOS v7.655  COSMOSv7655
(AirShowerMC)
kpolygC.f File Reference

Go to the source code of this file.

Functions/Subroutines

real *8 function kpolygc (n, x)
 

Function/Subroutine Documentation

◆ kpolygc()

real*8 function kpolygc ( integer  n,
real*8  x 
)

Definition at line 36 of file kpolygC.f.

References false.

36  implicit none
37  real*8 x
38  integer n
39 !
40 !
41 !
42 !
43 ! Computes n-th derivative of psi function with 7-8 significant dig
44 ! ts. psi(x) is logarithmic derivative of gamma function. psi(1)=-g
45 ! where g=0.57721566---Euler const. in Rossi notation, psi(s+1)=
46 ! dlog(s!)/ds=polyg(0,s+1.), where s! means factorial of s. x must
47 ! not be 0,-1,-2,---, and for practical reason must be > -20, n<
48 ! nmax, (of course must be >= 0). if so message printed, and polyg=
49 ! 1.0e35.
50 !
51 !
52  integer,parameter::nmax=50
53  real*8 f(nmax)
54  real*8 b(6)/8.333333e-2, -1.388889e-3, 3.3068783e-5,
55  1 -8.267196e-7, 2.087676e-8, -52.841901e-11/
56  logical first/.true./
57  integer i, nt, j, m
58  real*8 z, s, znt, z2, sn, sum, zn
59  save first
60 
61  if(first) then
62 ! compute factorial up to nmax
63  first=.false.
64  f(1)=1.
65  do i=2,nmax
66  f(i)=float(i-1)*f(i-1)
67  enddo
68  endif
69 !
70  z=x
71  if(z .gt. 0. .or. z - aint(z) .ne. 0. .and.
72  * (n .ge. 0 .and. n .lt. nmax) ) then
73  s=0.
74  nt=n+1
75  do while (z .lt. 4.)
76  znt=1.
77  do i=1,nt
78  znt=znt*z
79  enddo
80  s=s+1./znt
81  z=z+1.
82  enddo
83  s=f(nt)*s
84  z2=z*z
85  zn=1.
86  do while (nt .gt. 1)
87  nt=nt-1
88  zn=zn*z
89  enddo
90  sn=-1.
91  if(mod(n,2).ne.0) sn=1.
92  sum=0.
93  do i=1,6
94  j=7-i
95  m=j+j+n
96  sum=(sum+f(m)*b(j))/z2
97  enddo
98  sum=((sum+0.5*f(n+1)/z)/zn+s)*sn
99  if(n .eq. 0) then
100  kpolygc=log(z)+sum
101  else
102  kpolygc=sum+f(n)/zn*sn
103  endif
104  else
105  write(*,
106  * '( ''***error input to kpolygC: (z,n)='',e18.8,i10)') z,n
107  kpolygc=1.e36
108  endif
nodes z
dE dx *! Nuc Int sampling table e
Definition: cblkMuInt.h:130
real *8 function kpolygc(n, x)
Definition: kpolygC.f:36
logical, save first
Definition: cNRLAtmos.f:8
nodes i
block data cblkElemag data *AnihiE ! Eposi< 1 TeV, anihilation considered *X0/365.667/, ! radiation length of air in kg/m2 *Ecrit/81.e-3/, ! critical energy of air in GeV *MaxComptonE/1./, ! compton is considered below 1 GeV *MaxPhotoE/1.e-3/, ! above this, PhotoElectric effect neg. *MinPhotoProdE/153.e-3/, ! below 153 MeV, no gp --> hadrons ! scattering const not MeV *Knockon true
Definition: cblkElemag.h:7
********************block data cblkHeavy ********************integer j data *HeavyG2symbol *data *HeavyG2code kiron data j
Definition: cblkHeavy.h:36
block data include Zlatfit h c fitting region data data data data data d0 data data d0 data data m
Definition: ZlatfitBD.h:35
block data cblkElemag data *AnihiE ! Eposi< 1 TeV, anihilation considered *X0/365.667/, ! radiation length of air in kg/m2 *Ecrit/81.e-3/, ! critical energy of air in GeV *MaxComptonE/1./, ! compton is considered below 1 GeV *MaxPhotoE/1.e-3/, ! above this, PhotoElectric effect neg. *MinPhotoProdE/153.e-3/, ! below 153 MeV, no gp --> hadrons ! scattering const not MeV *Knockon ! knockon is considered Obsolete *PhotoProd false
Definition: cblkElemag.h:7
real(4), save b
Definition: cNRLAtmos.f:21
integer n
Definition: Zcinippxc.h:1
! structure defining a particle at production ! Basic idea of what is to be contained in ! the particle structue is that dynamical ones should be included those derivable from the particle code ! is not included ******************************************************type fmom momentum sequence union map real e endmap map real * x
Definition: Zptcl.h:21
dE dx *! Nuc Int sampling table f
Definition: cblkMuInt.h:130