function G = GriewangkGrad(x)
% The gradient of the Griewangk function.
% Input x is a column vector, n by 1.
% Version written for conventional optimization.
% K. Ming Leung, 10/17/03

n = length(x);
ri = sqrt((1:n)');
xri = x./ri
p = prod(cos(xri),1);
G = X/2000 + tan(xri./ri)./ri*p;
