c
c     Second Edition
c     Numerical Analysis:
c     The Mathematics of Scientific Computing
c     D.R. Kincaid & E.W. Cheney
c     Brooks/Cole Publ., 1996
c     ISBN 0-534-33892-5
c     COPYRIGHT (c) 1996
c
c     Section 7.3
c
c     Example of 5-point Gaussian integration formula
c     to integrate sqrt(x) over [0,1]
c
c
c     file: gauss5.f
c
      dimension w(0:2),x(0:2) 
      real a,b
      double precision x,w,S,sqrt,u,v,z,f
      data x(0) /0.0d0/
      data x(1) /0.53846 93101 05683d0/
      data x(2) /0.90617 98459 38664d0/
      data w(0) /0.56888 88888 88889d0/
      data w(1) /0.47862 86704 99366d0/
      data w(2) /0.23692 68850 56189d0/
      data a,b/0.,1./
c
      f(z) = sqrt(z)
c      
      print *
      print *,' 5-point Gaussian integration example'
      print *,' Section 7.3, Kincaid-Cheney'
      print *
c
      u = (a + b)*0.5d0
      S = w(0)*f(u)
      do 2 i=1,2
         u = ( (b - a)*x(i) + a + b)*0.5d0
         v = (-(b - a)*x(i) + a + b)*0.5d0
         S = S + w(i)*(f(u) + f(v))
 2    continue
      S = (b - a)*S*0.5d0
      print *,' S = ',S
c
      stop
      end
