Path of Steepest Descent
Steven M. Pederson
Department of Mathematics
Morehouse College
Atlanta, GA 30314 USA
spederso@morehouse.edu
2002 Steven M. Pederson
NOTE: This worksheet provides an introductory Calculus III student project
to model and graph the path of steepest descent down a hill.
Introduction
The following is an introductory student project for Maple which has been used by the author in Calculus III classes at Georgia Tech and Morehouse College . It is meant to be a group project for three students and possibly their first independent use of Maple. Students should be familiar with the geometric interpretation of the gradient vector of a function of two variables at a point. This project contains a short program to model and graph the path of steepest descent down a smooth hill. Students run and make small adjustments to the program, but do not write any programs.
The Project
Maple Project: Path of Steepest Descent
A path of steepest descent is a curve on a surface which goes "downhill" as rapidly as possible. In this project, you will use a program written for Maple to approximate the "path of steepest descent" given a starting point on a surface. Each path of steepest descent will be approximated by a finite number of points. The program will do this by computing the opposite of the gradient vector at each point and moving 1 step size in that direction to obtain the next point.
Maple contains a programming language which is useful for writing short programs. An algorithm to generate the points has been incorporated into the Maple program below.
Any program line beginning with "#" is a comment line and is not read by Maple as the program runs.
Next let's try out the program. In this example, the surface is a saddle f(x,y)= x^2-y^2. Starting at the point on the surface where x=4 and y=0, the program will generate 100 points and then plot them on the surface.
To run the program, put the cursor in the first line and press enter.
Now we need to call the procedure and provide the function x^2-y^2, two initial points x=4 and y = 0. the "false" parameter is option for displaying the points. If you change the 4th parameter to true, the individual points that approximate the curve will be listed. This feature will be used in later exercises. The last 4 parameters are values for x and y domains. These parameters will also be used later.
To rotate the plot, put the mouse cursor on the plot. Left click the mouse button and a box will appear. Continuing to hold the left mouse button down, move the cursor to rotate the graph.You may release the mouse button when you have obtain a view of the plot which best illustrates the surface and points. You may copy and paste this graph. One way is to right click on the graph and a pop up menu will allow you to select the copy option and copy the graph or you can left click on the graph and go to Edit from the menu bar of this worksheet and select copy or paste from there.
Next in Exercises we will learn how to plot two graphs together.
EXERCISE 1
We will start with a different starting point. This time change the current parameter from x0=4 and y0=0 to x0=4 and y0=0.1. We will also assign this procedure call with a name G1. Remember to press enter to execute the command. Note: The graph will not appear until the next exercise.
EXERCISE 2
To display the graph of G1 simply type in G1 to call it. Change the colon after G1 to a semicolon , press enter and the graph will appear.
EXERCISE 3
Now we will graph our original graph again and call it G2 with starting points x0=4 and y0=0. We will use "plots[display]" command to show the two graphs on the same plot. You should see two red curves on the plot after you have executed the commands. Rotate the plot to get a better view of the curves.
EXERCISE 4
For the saddle f(x,y) = x^2-y^2, choose 3 new starting points (different from those in the exercises above). Name the 3 graphs G3, G4, G5 . Generate their approximate paths of steepest descent and show them simultaneously on the surface. Be sure that the points from all three approximations are within your plot of the surface (see note below).
Note: Sometimes it is necessary to plot a larger portion of the surface. For example, if in your surface plot you want -2 <= x <= 6 and -3 <= y <= 8 . In the line that plots the surface graph, for the above example you will need to change "plot3d(f,0..4,-1..1)" to "plot3d(f,-2..6,-3..8)". You can change the domain by changing the last 4 parameters of the function call. To help choose the domain of the surface plot, you may want to see the x and y coordinates of the points generated. To do this, change the forth parameter from false to true and press enter to rerun the program. You will get the x, y, and z coordinates of each point. Use this information to adjust the domain of the surface plot in the procedure.
EXERCISE 5
Repeat problem 4 with surface f(x,y) = x*y.
EXERCISE 6
Let f(x,y) = sin(x*y). Generate the approximate paths of steepest descent for the starting points x0 = 0.7, y0 = 2 and x0 = 0.8, y0 = 2 and show them simultaneously on the surface. Rotate the plot to obtain a suitable view. Be sure your points are all within your plot of the surface.
OPTIONAL EXERCISE
In the above exercises, the number of points used for the approximation is always 100 . Try to modify the procedure such that n = the number of points desired for the approximation becomes an additional parameter to the procedure. Note: It may be best to copy and paste the procedure and change it's name to graphDescent2 and modify this new procedure.
EXTRA CREDIT PROBLEM
Change the program to approximate paths of steepest ascent. For the saddle f(x,y) = x^2-y^2, start at x0 = 4, y0 = 0.1 and go "uphill" as rapidly as possible.
Disclaimer: "While every effort has been made to validate the solutions in this worksheet, Waterloo Maple Inc. and the contributors are not responsible for any errors contained and are not liable for any damages resulting from the use of this material."