      implicit none
      double precision x,xnew,xold,aitken,g
      integer n
      g(x)=cos(x/3.d0)
      xold=0
      print*,xold
      x=g(xold)
      print*,x
      do n=1,15
          xnew = g(x)
          aitken = xnew - (xnew-x)**2/(xnew-2*x+xold)
          print*,xnew,aitken
          xold = x
          x = xnew
      enddo
      end
