{VERSION 5 0 "IBM INTEL NT" "5.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "" -1 256 "" 0 1 255 0 0 1 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 257 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 261 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 262 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 263 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 264 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 265 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 266 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 267 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 268 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 269 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 270 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 271 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 272 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 273 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 274 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 275 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 276 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 277 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 278 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Century Schoolbook" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "R3 Font 0" -1 256 1 {CSTYLE " " -1 -1 "Lucida Sans Typewriter" 1 10 255 0 0 1 2 2 2 2 2 2 1 1 1 1 } 1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "R3 Font 2" -1 257 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT 256 39 "MAPLE PROJECT: PATH OF ST EEPEST DESCENT" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 3 "by " }{TEXT 257 15 "Steve Pederson " }{TEXT -1 21 "(versio n of 10-13-02)" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 72 "A path of steepest descent is a curve on a surface which \+ goes \"downhill\"" }}{PARA 0 "" 0 "" {TEXT -1 75 "as rapidly as possib le. In this project, you will use a program written for" }}{PARA 0 "" 0 "" {TEXT -1 74 "Maple to approximate the \"path of steepest descent \" given a starting point" }}{PARA 0 "" 0 "" {TEXT -1 70 "on a surface . Each path of steepest descent will be approximated by a" }}{PARA 0 "" 0 "" {TEXT -1 24 "finite number of points." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 71 "Maple contains a programm ing language which is useful for writing short" }}{PARA 0 "" 0 "" {TEXT -1 72 "programs. An algorithm to generate the points has been in corporated into" }}{PARA 0 "" 0 "" {TEXT -1 71 "the Maple program belo w. For the program you enter the following items:" }}{PARA 0 "" 0 "" {TEXT -1 54 "1. f(x,y), where z = f(x,y) is the surface's equation," } }{PARA 0 "" 0 "" {TEXT -1 58 "2. n = the number of points desired for \+ the approximation," }}{PARA 0 "" 0 "" {TEXT -1 76 "3. (x0,y0), where ( x0,y0,f(x0,y0)) is the starting point on the surface, and" }}{PARA 0 " " 0 "" {TEXT -1 36 "4. d = the step size between points." }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 72 "Any program line b eginning with \"#\" is a comment line and is not read by" }}{PARA 0 " " 0 "" {TEXT -1 26 "Maple as the program runs." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 258 20 "TEXT OF THE PROGRAM:" }} {PARA 0 "" 0 "" {TEXT 266 40 "#enter your information on the next line " }}{PARA 0 "" 0 "" {TEXT 267 49 "f:=(x,y)-> x^2-y^2; n:=100; x0:=4; y 0:=0; d:=1/n:" }}{PARA 0 "" 0 "" {TEXT 268 43 "pts:=array(0..n): pts[0 ]:=[x0,y0,f(x0,y0)]:" }}{PARA 0 "" 0 "" {TEXT 269 17 "for i from 1 to \+ n" }}{PARA 0 "" 0 "" {TEXT 270 2 "do" }}{PARA 0 "" 0 "" {TEXT 271 34 " newx0:=evalf(x0-d*D[1](f)(x0,y0));" }}{PARA 0 "" 0 "" {TEXT 272 34 "ne wy0:=evalf(y0-d*D[2](f)(x0,y0));" }}{PARA 0 "" 0 "" {TEXT 273 47 "x0:= newx0; y0:=newy0; pts[i]:=[x0,y0,f(x0,y0)];" }}{PARA 0 "" 0 "" {TEXT 274 3 "od:" }}{PARA 0 "" 0 "" {TEXT 275 12 "#print(pts):" }}{PARA 0 " " 0 "" {TEXT 276 78 "h1:=plots[pointplot3d](convert(pts,list),color=re d,connect=true, thickness=4):" }}{PARA 0 "" 0 "" {TEXT 277 25 "h2:=plo t3d(f,0..4,-1..1):" }}{PARA 0 "" 0 "" {TEXT 278 51 "plots[display](\{h 1,h2\},style=WIREFRAME,axes=BOXED);" }}{PARA 0 "" 0 "" {TEXT -1 0 "" } }{PARA 0 "" 0 "" {TEXT -1 72 "Next let's try out the program. In this \+ example, the surface is a saddle" }}{PARA 0 "" 0 "" {TEXT -1 59 "f(x,y )= x^2-y^2. Starting at the point on the surface where" }}{PARA 0 "" 0 "" {TEXT -1 71 "x=4 and y=0, the program will generate 100 points an d then plot them on" }}{PARA 0 "" 0 "" {TEXT -1 82 "the surface. To ru n the program, put the cursor in the first line and press enter." }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 447 "#e nter your information on the next line\nf:=(x,y)-> x^2-y^2; n:=100; x0 :=4; y0:=0; d:=1/n:\npts:=array(0..n): pts[0]:=[x0,y0,f(x0,y0)]:\nfor \+ i from 1 to n\ndo\nnewx0:=evalf(x0-d*D[1](f)(x0,y0));\nnewy0:=evalf(y0 -d*D[2](f)(x0,y0));\nx0:=newx0; y0:=newy0; pts[i]:=[x0,y0,f(x0,y0)];\n od:\n#print(pts):\nh1:=plots[pointplot3d](convert(pts,list),color=red, connect=true, thickness=4):\nh2:=plot3d(f,0..4,-1..1):\nplots[display] (\{h1,h2\},style=WIREFRAME,axes=BOXED);" }{TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 73 "To rotate the plot, put the arrow cursor \+ on the plot. Hold down the mouse" }}{PARA 0 "" 0 "" {TEXT -1 71 "butto n and a box will appear. Continuing to hold the mouse button down," }} {PARA 0 "" 0 "" {TEXT -1 70 "move the cursor to rotate the box, then r elease the mouse button. Move" }}{PARA 0 "" 0 "" {TEXT -1 73 "the curs or to \"edit\" and choose \"redraw\" (on some versions of Maple, just " }}{PARA 0 "" 0 "" {TEXT -1 74 "press enter). Obtain a view of the pl ot which best illustrates the surface" }}{PARA 0 "" 0 "" {TEXT -1 56 " and points. Notice that you may copy and paste the plot." }}{PARA 0 " " 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 259 10 "EXERCISE 1" }} {PARA 0 "" 0 "" {TEXT -1 71 "Place your figure from above at the arrow head prompt below. Be sure the" }}{PARA 0 "" 0 "" {TEXT -1 19 "points \+ are in view." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 260 10 "EXERCISE 2" }} {PARA 0 "" 0 "" {TEXT -1 69 "Copy and paste the program to the arrowhe ad prompt below. Do not run" }}{PARA 0 "" 0 "" {TEXT -1 71 "it yet. F irst change the starting point to x0=4, y0=0.1. Also, near the" }} {PARA 0 "" 0 "" {TEXT -1 70 "bottom of the program are lines that begi n with \"h1\" and \"h2\". h1 is a" }}{PARA 0 "" 0 "" {TEXT -1 75 "supr essed plot of the points and h2 is a supressed plot of the surface. Th e" }}{PARA 0 "" 0 "" {TEXT -1 72 "line that begins with \"plots[displa y]\" shows h1 and h2 in the same plot." }}{PARA 0 "" 0 "" {TEXT -1 77 "In the bottom three or four lines of the program, change h1 to \"h3\" and h2 to" }}{PARA 0 "" 0 "" {TEXT -1 70 "\"h4\". This so that h1 and h2 from exercise 1 are not lost. Now run the" }}{PARA 0 "" 0 "" {TEXT -1 73 "program. Rotate your plot to obtain a suitable view and i nclude it below." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 261 10 "EXERCISE 3" }}{PARA 0 "" 0 "" {TEXT -1 74 "Next we'll combine the points gener ated in exercises 1 and 2 into a single" }}{PARA 0 "" 0 "" {TEXT -1 73 "plot (we'll plot h1 and h3 together with the surface). In the line below," }}{PARA 0 "" 0 "" {TEXT -1 74 "press enter. Then rotate the p lot to obtain a suitable view and include it" }}{PARA 0 "" 0 "" {TEXT -1 6 "below." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 54 "plots[display](\{h1 ,h3,h4\},style=WIREFRAME,axes=BOXED);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 262 10 "EXERCISE 4" }}{PARA 0 " " 0 "" {TEXT -1 72 "For the saddle f(x,y) = x^2-y^2, choose 3 new star ting points (different" }}{PARA 0 "" 0 "" {TEXT -1 71 "from those in t he exercises above). Generate their approximate paths of" }}{PARA 0 " " 0 "" {TEXT -1 69 "steepest descent and show them simultaneously on t he surface. Be sure" }}{PARA 0 "" 0 "" {TEXT -1 69 "that the points fr om all three approximations are within your plot of" }}{PARA 0 "" 0 " " {TEXT -1 29 "the surface (see note below)." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 76 "Note: Sometimes it is necessary to plot a larger portion of the surface. For" }}{PARA 0 "" 0 "" {TEXT -1 72 "example, if in your surface plot you want -2 <= x <= 6 an d -3 <= y <= 8," }}{PARA 0 "" 0 "" {TEXT -1 61 "then change part of th e next to last line of the program from" }}{PARA 0 "" 0 "" {TEXT -1 79 "\"plot3d(f,0..4,-1..1)\" to \"plot3d(f,-2..6,-3..8)\". To help cho ose the domain of" }}{PARA 0 "" 0 "" {TEXT -1 75 "the surface plot, yo u may want to see the x and y coordinates of the points" }}{PARA 0 "" 0 "" {TEXT -1 72 "generated. To do this, remove \"#\" from the line \" #print(pts):\" and rerun" }}{PARA 0 "" 0 "" {TEXT -1 72 "the program. \+ You will get the x, y, and z coordinates of each point. Use" }}{PARA 0 "" 0 "" {TEXT -1 58 "this information to adjust the domain of the su rface plot." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 " > " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 263 10 "EXERCISE 5" }} {PARA 0 "" 0 "" {TEXT -1 46 "Repeat problem 4 with the surface f(x,y) \+ = xy." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 264 10 "EXERCISE 6" }}{PARA 0 " " 0 "" {TEXT -1 76 "Let f(x,y) = sin(xy). Generate the approximate pat hs of steepest descent for" }}{PARA 0 "" 0 "" {TEXT -1 71 "the startin g points x0 = 0.7, y0 = 2 and x0 = 0.8, y0 = 2 and show them" }}{PARA 0 "" 0 "" {TEXT -1 73 "simultaneously on the surface. Rotate the plot \+ to obtain a suitable view." }}{PARA 0 "" 0 "" {TEXT -1 60 "Be sure you r points are all within your plot of the surface." }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 265 20 "EXTRA CREDIT PROBLEM" }} {PARA 0 "" 0 "" {TEXT -1 74 "Change the program to approximate paths o f steepest ascent. For the saddle" }}{PARA 0 "" 0 "" {TEXT -1 73 "f(x, y) = x^2-y^2, start at x0 = 4, y0 = 0.1 and go \"uphill\" as rapidly a s" }}{PARA 0 "" 0 "" {TEXT -1 9 "possible." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "14 0 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }