# defining the function. At y=0 to get a 1D cut at the origin
def ackley_1d(x, y=0):
# the formula is rather large
out = (-20*np.exp(-0.2*np.sqrt(0.5*(x**2 + y**2)))
- np.exp(0.5*(np.cos(2*np.pi*x) + np.cos(2*np.pi*y)))
+ np.e + 20)
# returning
return out