COSMOS v7.655  COSMOSv7655
(AirShowerMC)
ktrpzIntegT.f
Go to the documentation of this file.
1 ! Trapezoidal integral of a given table data.
2  subroutine ktrpzintegt(t, intv, n, x0, dx, x, ans)
3  implicit none
4  integer intv ! input. see below
5  integer n ! input. number of data values
6  real*8 t(intv, n) ! input. t(1, 1), t(1, 2), .. t(1, n) are used.
7  ! function values at x0, x0+dx, ..
8  real*8 x0 ! input the leftmost value of x.
9  real*8 dx ! input. step of x.
10  real*8 x ! input. integral is from x0 to x.
11  real*8 ans ! output. integral value
12  real*8 nx
13  integer i, m
14 
15  m = (x - x0)/(0.9999999d0*dx) + 1
16  nx = x0 + (m-1) * dx
17 
18 
19  ans = 0.
20  do i = 2, m-1
21  ans = ans + t(1, i)
22  enddo
23 
24  if(m .gt. 1) then
25  ans = (ans + (t(1,1) + t(1, m))/2)* dx
26  endif
27 
28  if(m .lt. n) then
29  ans = ans +
30  * ((t(1, m+1) - t(1,m))*(x - nx)/dx + t(1,m))*(x-nx)/2
31  endif
32  end
block data cblkEvhnp ! currently usable models data RegMdls ad *special data *Cekaon d0
Definition: cblkEvhnp.h:5
subroutine ktrpzintegt(t, intv, n, x0, dx, x, ans)
Definition: ktrpzIntegT.f:3