function sum=F2(x)
    %%Ackley function
     m=length(x);
     sum1=0;
     sum2=0;
     a=20;
     b=0.2;
     c=2*pi;
     for j=1:m
         sum1=sum1+x(j).*x(j);
     end
     for j=1:m
         sum2=sum2+cos(c.*x(j));
     end
     sum=-a.*exp(-b*sqrt(sum1./m))-exp(sum2./m)+a+exp(1);
endfunction