COSMOS v7.655  COSMOSv7655
(AirShowerMC)
kexpiC.f
Go to the documentation of this file.
1 ! This is a copy of kexpi.f from Epics. The name is changed by
2 ! attaching C in the last part of each name
3 ! test implicit none real*8
4 ! kexpiC, x integer i x = 13.d0 do i = 1, 150 write(*, *) x, kexpiC(x) x =
5 ! x + .01d0 enddo end
6 ! **************************************************************** * * *
7 ! kexpiC: exponential integral * * keimlg: kexpiC(x)- log(x) * * keiexp:
8 ! keimlg(x) * exp(-x) * * *
9 ! ****************************************************************
10 !
11 ! /usage/ these are all functions.
12 !
13 ! definition: kexpiC(x)= g + sum ( x**n/n/n' ) + log(x)
14 !
15 ! where g is euler const(0.577..)
16 !
17 ! x may be <= 0, in keimlg or keiexp
18 !
19 !
20 !
21  real*8 function kexpic(x)
22  implicit none
23  real*8 x
24 !
25  real*8 kexpicoreC, s, g
26  data g/0.577215664d0/
27 
28  s = kexpicorec(x)
29  if(x .lt. 14.) then
30  kexpic=s + g + log(x)
31  else
32  kexpic=s*exp(x)
33  endif
34  end
35 !
36 ! ***********
37  real*8 function keimlgc(x)
38 ! ***********
39 !
40 ! ei(x)-log(x)
41 !
42  implicit none
43  real*8 x
44  real*8 g, kexpicoreC, s
45  data g/0.577215664d0/
46 
47  s = kexpicorec(x)
48  if(x .lt. 14.) then
49  keimlgc = s + g
50  else
51  keimlgc = exp(x)*s - log(x)
52  endif
53  end
54 
55 ! ***********
56  real*8 function keiexpc(x)
57 ! ***********
58 !
59 ! (ei(x)-log(x))*exp(-x)
60 !
61  implicit none
62  real*8 x
63  real*8 g, kexpicoreC, s
64  data g/0.577215664d0/
65 
66  s = kexpicorec(x)
67  if(x .lt. 14.) then
68  keiexpc = (s + g)*exp(-x)
69  else
70  keiexpc = s-exp(-x)* log(x)
71  endif
72  end
73 ! **********************************
74  real*8 function kexpicorec(x)
75  implicit none
76 !
77  real*8 x
78  real*8 eps, s, tmp, fn, tmp2
79 !
80  data eps/1.d-6/
81 
82  s=0.
83  tmp=1.
84  if(x .eq. 0. ) then
85  kexpicorec = 0.
86  elseif(x .lt.14.) then
87  fn=1.
88  5 continue
89  tmp=tmp*x/fn
90  tmp2=tmp/fn
91  s=s+tmp2
92  if(abs(tmp2/s) .gt. eps) then
93  fn=fn+1.
94  go to 5
95  endif
96  kexpicorec = s
97  else
98  fn=15.
99  105 continue
100  s=s+tmp
101  fn=fn-1.
102  if(fn.gt.0.) then
103  tmp=tmp*x/fn
104  go to 105
105  endif
106  s=s/tmp/x
107  kexpicorec = s
108  endif
109  end
real *8 function keimlgc(x)
Definition: kexpiC.f:38
real *8 function kexpicorec(x)
Definition: kexpiC.f:75
real *8 function keiexpc(x)
Definition: kexpiC.f:57
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
dE dx *! Nuc Int sampling table d
Definition: cblkMuInt.h:130
real *8 function kexpic(x)
Definition: kexpiC.f:22