

      INCLUDE 'STDHDR.FOR'
      REAL  y1( 0: maxv)     !Array of function values
      REAL  xl1              !lower limit of integration
      REAL  xh1              !upper limit of integration
      REAL  ans1             !value of integral
      INTEGER  xxl1,xxh1,i1,numseg
      REAL  sp,i


      DO i1 = 0, 10          !sets up a vector which is a piecewise
                             !approximation of the curve y = e^x
        i = i1/10.0          !across the interval 0 - 1}
         y1(i1) = exp(i)
      END DO
      xl1 = 0.0
      xxl1 = 0
      xxh1 = 10
      xh1 = 1.0
      sp = 1.0/10.0
      CALL IntegrateVector(y1,sp,xxl1,xxh1,ans1)
      PRINT *, 'Integrate Vector'
      PRINT *, 'Area under the curve = ', ans1
      PRINT *
      PRINT *, 'Integrate Function'
      DO i1 = 1, 10
        numseg = 2*i1
        CALL IntegrateFunction(numseg,xl1,xh1,ans1)
        PRINT *, 'Number of segments = ',numseg
        PRINT *, '  Area under the curve = ',ans1
      END DO
      END






