Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
pysimp.f
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file pysimp.f
1 
2 C*********************************************************************
3 
4 C...PYSIMP
5 C...Simpson formula for an integral.
6 
7  FUNCTION pysimp(Y,X0,X1,N)
8 
9 C...Double precision and integer declarations.
10  IMPLICIT DOUBLE PRECISION(a-h, o-z)
11  IMPLICIT INTEGER(i-n)
12  INTEGER pyk,pychge,pycomp
13 
14 C...Local variables.
15  DOUBLE PRECISION y,x0,x1,h,s
16  dimension y(0:n)
17 
18  s=0d0
19  h=(x1-x0)/n
20  DO 100 i=0,n-2,2
21  s=s+y(i)+4d0*y(i+1)+y(i+2)
22  100 CONTINUE
23  pysimp=s*h/3d0
24 
25  RETURN
26  END