      program dquad
c driver for quadpack
      implicit double precision (a-h, o-z)
      external f
      parameter (limit=50, lenw=4*limit)
      dimension iwork(limit), work(lenw)
      open (unit=8, file='outquad', iostat=ios, err=100)
c lower limit of itegration
      a=-1.0d+00
c upper limit of integration
      b=2.0d+00
c absolute accuracy requested
      epsabs=1.0d-15
c relative accuracy requested
      epsrel=1.0d-09
      do 20 l=1, 3000
c key for choice of local integration rule: 
c     a Gauss-Kronrod pair is used with
c                7 - 15 points if key .lt. 2,
c               10 - 21 points if key  =   2,
c               15 - 31 points if key  =   3,
c               20 - 41 points if key  =   4,
c               25 - 51 points if key  =   5,
c               30 - 61 points if key .gt. 5
      do 10 key=1, 6
 
      call dqag (f, a, b, epsabs, epsrel, key, result, abserr, neval, 
     *           ier, limit, lenw, last, iwork, work)

      if (l .eq. 1) then
      write (8, *) 'integral                       =', result
      write (8, *) 'absolute error                 =', abserr
      write (8, *) 'number of integrand evaluations=', neval
      end if
   10 continue
   20 continue
      stop
      
  100 write (8, *) 'ios=', ios
      stop
 
      end
