      function funmin (x,n)
      implicit double precision (a-h,o-z)
      dimension x(n)
      funmin = 0
      do 1 i=1,2
        do 2 j = 1,5
          funmin = funmin -j*sin((j+1)*x(i)+j)
2       continue
1     continue
      end
      subroutine granal(n,x,g) 
      implicit double precision (a-h,o-z)
      dimension x(n),g(n)
      do 2 j=1,2
      g(j)=0
        do 1 i=1,5
          g(j)=g(j)-i*(i+1)*cos((i+1)*x(j)+i)
1       continue
2     continue
      end
