Question: 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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!