COSMOS v7.655  COSMOSv7655
(AirShowerMC)
kzeta2a.f
Go to the documentation of this file.
1 ! implicit none
2 ! real*8 kzeta2a, a
3 ! do a=0., 1., 0.02
4 ! write(*, *) sngl(a), sngl(kzeta2a(a))
5 ! enddo
6 ! end
7 ! ****************************************************************
8 ! * *
9 ! * kzeta2a: compute sum of a**m/m**2 from m=1 to inf ( 0<=a<=1) *
10 !
11 ! a a2 a3 a4
12 ! --- + --- + ---- + ---
13 ! 2 2 2 2
14 ! 1 2 3 4
15 ! ****************************************************************
16 !
17 ! usage: real*8 kzeta2a
18 ! f = kzeta2a(a)
19 !
20 ! method: use the series as it is if a < .5 to get sum with
21 ! relative error 1/1000 else
22 ! use polinomial approximation to result obtained by
23 ! equivalent integral ( 0 to -ln(1-a) of y/(exp(y) -1) )
24 !
25 ! zeta2a(1.) = zeta(2) =pi**2/6 = 1.644934
26 !
27 ! note: accuracy is only a few to several digits.
28 !
29  real*8 function kzeta2a(a)
30  implicit none
31  real*8 a
32 !
33  real*8 c(7)/
34  * 29.55194, -260.5342, 955.5774, -1843.917, 1984.555, -1129.490,
35  * 265.9021/
36 
37  real*8 s, r, ak, tmp
38  integer k, j
39 !
40  s=0.
41  if(a .lt. .5) then
42  r=1.
43  if(a .eq. 0.) r=0.
44  ak=a
45  k=1
46  do while (r .gt. 1.e-3 )
47  tmp= ak/k**2
48  s=s+tmp
49  r=abs(tmp/s)
50  ak=ak*a
51  k=k+1
52  enddo
53  else
54  do j=7, 1, -1
55  s= s *a + c(j)
56  enddo
57  endif
58  kzeta2a=s
59  end
60 
dE dx *! Nuc Int sampling table e
Definition: cblkMuInt.h:130
real *8 function kzeta2a(a)
Definition: kzeta2a.f:30