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.1
c
c     Generate a triangular array of derivatives 
c     using Richardson interpolation 
c
c
c     file: ex6s71.f
c
      parameter (M=4)
      dimension d(0:M,0:M)
      f(x) = atan(x)
      phi(x,h) = (f(x+h) - f(x-h))/(2.0*h)
c
      print *
      print *,' Complete Richardson extrapolation'
      print *,' Section 7.1, Kincaid-Cheney'
      print *
      print 6,'n','D(n,0)','D(n,1)','D(n,2)','D(n,3)','D(n,4)'

c
      h = 1.0
      a = sqrt(2.0)
c
      do 2 n=0,M
         d(n,0) = phi(a,h/(2**n))
 2    continue
c
      do 4 k=1,M
         do 3 n=k,M
            d(n,k) = d(n,k-1) + (d(n,k-1) - d(n-1,k-1))/((4**k) - 1.) 
 3       continue
 4    continue
c
      do 5 n=0,M
         print 7,n,(d(n,k),k=0,n)
 5    continue
c
 6    format(a6,a13,4(a14))
 7    format(1x,i5,2x,5(e13.6,2x))
      stop 
      end
