      program TDGINTGRL1
      implicit real*8(a-h,o-z)
      
      parameter (m=100000)
      real*8 y,y2,x,r0,f(0:m)
      integer n
c----------------------------------------------------------------------
c TDGINTGRL1 tests the integration routine DGINTGRL1 for different values 
c of the integration boundary

      
c the first function to be integrated is exp(-1d-1*x)*cos(x) from 0 to x
      n = 100
      r0 = 1d1

      write(*,*) '# of gridpoints:',n,'  grid parameter r0 =',r0

      dy = 1d0/dfloat(n)

      do j=5,100,10
         x = j
      
         do i=0,n
            y = i*dy
c  evaluate function on gridpoints
            y2 = r0*((r0+x)/(x*y+r0) -1d0)
            f(i) = cos(-y2)*exp(-1d-1*y2)
         enddo
      
c  call subroutine
         
      z=dgintgrl1(n,r0,f,x)

c  write output
      
      write(*,4000) x,z-(1d1/101d0 - 1d1/101d0*(exp(-1d-1*x)
     &                                   *(cos(x)-10*sin(x))))
 4000 format('x=',F5.0,'   abs. error:',F20.15)
      enddo





      n = 100
      r0 = 5d2
      
      write(*,*)
      write(*,*) '# of gridpoints:',n,'  grid parameter r0 =',r0

      dy = 1d0/dfloat(n)

      do j=5,100,10
         x = j
      
         do i=0,n
            y = i*dy
c  evaluate function on gridpoints
            y2 = r0*((r0+x)/(x*y+r0) -1d0)
            f(i) = cos(-y2)*exp(-1d-1*y2)
         enddo
      
c  call subroutine
         
      z=dgintgrl1(n,r0,f,x)

c  write output
      
      write(*,4010) x,z-(1d1/101d0 - 1d1/101d0*(exp(-1d-1*x)
     &                                   *(cos(x)-10*sin(x))))
 4010 format('x=',F5.0,'   abs. error:',F20.15)
      enddo

      stop
      end






