Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Output should be: Please enter a positive integer N: 1 The maximum value found was: -0.13696986029286057. The maximum value occurred at (0.0, 1.0). Grid search
Output should be:
"Please enter a positive integer N: 1
The maximum value found was: -0.13696986029286057.
The maximum value occurred at (0.0, 1.0)."
Grid search is a technique for approximating the maximum value of a function (although there are often better techniques). For simplicity, suppose that we have a continuous function of two variables: f(x,y) defined on the square (x,y)[0,1][0,1]. We can take a positive integer N, and consider the (N+1)2 points (Ni,Nj) for i=0,1,N,j=0,1,,N, and use the maximum computed value of f at these points as an approximation to the true maximum value of f over the square. (The maximum value exists by the Extreme Value Theorem, and the approximation obtained in this fashion will converge to the true maximum value as N.) Write a script that uses grid search to approximate the maximum value of the function f(x,y)=(e(xy)+(x0.3)2+(y0.7)2)(0.25(x0.5)2(y0.5)2) over the square [0,1][0,1]. The script should report both the approximate maximum value and the location of the approximate maximum value (in the event of a tie, report any single location where the approximate maximum occurs)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started