Write a program to perform optimization of a 2D polynomial function f(x, y) using the method of steepest descent or ascent.
The algorithm is given in the textbook but write it down in pseudo-code first. Use the method of Golden Section for the optimization problem in 10 that is produced as a step in the solution. You will also need to have a function that takes partial differentials of f(x, y) with respect to x and y. 8ut before all that, you will have to devise a method to represent a general polynomial in 2 variables.
Test your program using this function in the textbook (Numerical Methods for Engineers by Chapra and Canale, 6″ Edition, Example 14.4, P381):
f(x, y)= 2xy + 2x 99 – 2y7,
with the initial point at (-1, 1). Plot the function as a 3D surface and the steps your program takes to reach the optimum point. Mark the optimum point with a marker (such as a cross).
Then test it again using two different functions of your own choice.
Sample Solution