## Question 3: Ackley's function (8 marks) Write code to input two numbers from the user (x1 and x2) and then print out

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

## Question 3: Ackley's function (8 marks) Write code to input two numbers from the user (x1 and x2) and then print out

Post by answerhappygod »

## Question 3: Ackley's function (8 marks) Write code to input
two numbers from the user (x1 and x2) and then print out the result
of the following fuction (known as Ackley's function). You can test
your code using the following test cases: f(0,0) $\approx$ 0, and
f(31.5, 31.5) $\approx$ 22.314. **Hint**: In Python, trigonometric
functions (such as cos and sin) are defined in the math package.
$f(x_1,x_2) = -20\,\textrm{exp}\big(-0.2\sqrt{0.5(x_1^2 +
x_2^2)}\big)-\textrm{exp}(0.5(\cos2\pi x_1 + \cos2\pi x_2)) + 20 +
\textrm{exp}(1)$
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply