http://www.sfu.ca/~ssurjano/ackley.html
import math def ackley(xx): # xx = [x1, x2] a = 20 b = 0.2 c = 2 * math.pi sum1 = 0 sum2 = 0 for ii in range(2): xi = xx[ii] sum1 = sum1 + xi**2 sum2 = sum2 + math.cos(c*xi) term1 = -a * math.exp(-b * math.sqrt(sum1/2)) term2 = -math.exp(sum2/2) y = term1 + term2 + a + math.exp(1) return y if __name__ == '__main__': xx=[5,9] print(ackley(xx))