{VERSION 2 3 "DEC ALPHA UNIX" "2.3" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 256 "" 0 1 0 0 0 0 0 1 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 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 0 1 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 } {CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 1 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 }{CSTYLE "" -1 262 "" 0 1 0 0 0 0 0 1 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 } {CSTYLE "" -1 264 "" 0 1 0 0 0 0 0 1 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 }{CSTYLE "" -1 266 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 267 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 } {CSTYLE "" -1 268 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 269 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 270 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 271 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 } {CSTYLE "" -1 272 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 273 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 274 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 275 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 } {CSTYLE "" -1 276 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 }1 0 0 0 6 6 0 0 0 0 0 0 -1 0 }{PSTYLE "T itle" 0 18 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 1 0 0 0 0 0 0 }3 0 0 -1 12 12 0 0 0 0 0 0 19 0 }{PSTYLE "Author" 0 19 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 8 8 0 0 0 0 0 0 -1 0 }} {SECT 0 {PARA 18 "" 0 "" {TEXT -1 14 "Extreme Values" }}{PARA 19 "" 0 "" {TEXT -1 10 "Bill Farr " }}{PARA 19 "" 0 "" {TEXT -1 13 "February 2 000" }}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 12 "Introduction" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 118 "This worksheet contains Maple commands t hat should help you solve the lab exercises. The focus is on using th e Maple " }{TEXT 256 5 "solve" }{TEXT -1 5 " and " }{TEXT 257 6 "fsolv e" }{TEXT -1 36 " commands to locate critical points." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 19 "First, we load the " } {TEXT 258 5 "plots" }{TEXT -1 83 " package, since we'll often use cont our plots to help us classify critical points. " }}}{EXCHG {PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 12 "with(plots):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 15 "An easy exa mple" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 79 "This is an easy example, o ne that could be done by hand without too much work. " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 28 "First, define the function. " }}{PARA 0 " > " 0 "" {MPLTEXT 1 0 24 "f := (x,y) -> x^2+2*y^2;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 193 "Many times, plotting the function first helps yo u plan what to do next. From the plot below, we can tell that this fun ction only has one critical point and that the function is minimized t here." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "plot3d(f(x,y),x=-3..3,y=-3 ..3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 95 "A contour plot is can al so be useful for finding the approximate location of a critical point. " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "contourplot(f(x,y),x=-3..3,y=- 3..3);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 50 "Finding the critical po int is easy to do with the " }{TEXT 259 5 "solve" }{TEXT -1 10 " comma nd. " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "solve(\{diff(f(x,y),x)=0,di ff(f(x,y),y)=0\},\{x,y\});" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 69 "A more complicated examp le with an infinite number of critical points" }}{EXCHG {PARA 0 "" 0 " " {TEXT -1 93 "This is a more complicated example. Note that the cosin e term makes the function periodic in " }{XPPEDIT 18 0 "y" "I\"yG6\"" }{TEXT -1 2 ". " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "g := (x,y) -> ex p(-x^2)*cos(y);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 108 "The solve com mand only gives one solution, though plotting the function would show \+ that there must be more. " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "solve( \{diff(g(x,y),x)=0,diff(g(x,y),y)=0\},\{x,y\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 142 "In some cases, especially when trig functions are i nvolved, it is useful to look at the partial derivatives. The express ions below show that " }{XPPEDIT 18 0 "diff(g(x,y),y" "-%%diffG6$-%\"g G6$%\"xG%\"yGF)" }{TEXT -1 21 " can only be zero if " }{XPPEDIT 18 0 " sin(y) = 0" "/-%$sinG6#%\"yG\"\"!" }{TEXT -1 18 ". This means that " } {XPPEDIT 18 0 "y" "I\"yG6\"" }{TEXT -1 33 " must be an integral multip le of " }{XPPEDIT 18 0 "Pi" "I#PiG6\"" }{TEXT -1 16 ". Using this in \+ " }{XPPEDIT 18 0 "diff(g(x,y),x)" "-%%diffG6$-%\"gG6$%\"xG%\"yGF(" } {TEXT -1 12 " shows that " }{XPPEDIT 18 0 "x=0" "/%\"xG\"\"!" }{TEXT -1 90 " for a critical point. So this function has an infinite number \+ of critical points give by " }{XPPEDIT 18 0 "x=0" "/%\"xG\"\"!" } {TEXT -1 5 " and " }{XPPEDIT 18 0 "y= n Pi" "/%\"yG*&%\"nG\"\"\"%#PiGF &" }{TEXT -1 18 " for all integers " }{XPPEDIT 18 0 "n" "I\"nG6\"" } {TEXT -1 1 "." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "diff(g(x,y),x);" } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "diff(g(x,y),y);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 164 "Using a contour plot, it is easy \+ to see that the critical points are all local minima or maxima. Plotti ng the function would allow you to finish the classification." }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "contourplot(g(x,y),x=-2..2,y=0..2*P i);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 33 "Another example: RootOf notation " }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 4 "The " }{TEXT 260 5 "solve" }{TEXT -1 130 " command didn't give all the critical points in the previous example. \+ In this example, it gives all the critical points, but uses " }{TEXT 261 6 "RootOf" }{TEXT -1 40 " notation that may be unfamiliar to you. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 46 "This \+ function only contains integer powers of " }{XPPEDIT 18 0 "x" "I\"xG6 \"" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "y" "I\"yG6\"" }{TEXT -1 33 ", \+ so there is some hope that the " }{TEXT 262 6 "solve " }{TEXT -1 19 "c ommand will work. " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "h := (x,y) -> (x^2+2*y)*(-x^2+y^2+1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 55 "Here \+ we try the solve command. If you haven't seen the " }{TEXT 263 7 "Root Of " }{TEXT -1 70 "notation before you may find it confusing. Essentia lly Maple uses the " }{TEXT 264 6 "RootOf" }{TEXT -1 109 " notation as a shorthand for multiple roots. The result below shows two families o f solutions. The variable " }{XPPEDIT 18 0 "_Z" "I#_ZG6\"" }{TEXT -1 6 " in a " }{TEXT 265 7 "RootOf " }{TEXT -1 54 "expression should be j ust though of as a placeholder. " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 57 "sol1 := solve(\{diff(h(x,y),x)=0,diff(h(x,y),y)=0\},\{x,y\});" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 4 "The " }{TEXT 266 9 "allvalues" } {TEXT -1 33 " command can be used to expand a " }{TEXT 267 7 "RootOf \+ " }{TEXT -1 70 "structure. Here, we pick out the first family of solut ions, which was " }{XPPEDIT 18 0 "\{x=0,y= RootOf(1+3*_Z^2)" "<$/%\"xG \"\"!/%\"yG-%'RootOfG6#,&\"\"\"\"\"\"*&\"\"$F-*$%#_ZG\"\"#F-F-" } {TEXT -1 25 ". What this says is that " }{XPPEDIT 18 0 "x=0" "/%\"xG\" \"!" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "y" "I\"yG6\"" }{TEXT -1 29 " \+ is any root of the equation " }{XPPEDIT 18 0 "1+3*y^2=0" "/,&\"\"\"\" \"\"*&\"\"$F%*$%\"yG\"\"#F%F%\"\"!" }{TEXT -1 7 ". The " }{TEXT 268 9 "allvalues" }{TEXT -1 138 " command solves for the two roots. Note t hat they are both complex and would be discarded, since we only care a bout real critical points. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 27 "Note also that we gave our " }{TEXT 269 5 "solv e" }{TEXT -1 79 " command a label, which made it easy to extract the f irst family of solutions. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 27 "The second argument to the " }{TEXT 270 9 "allval ues" }{TEXT -1 32 " command can be either the word " }{TEXT 271 9 "dep endent" }{TEXT -1 13 " or the word " }{TEXT 272 12 "independent." } {TEXT -1 49 " For this lab, and in most cases, you should use " } {TEXT 273 9 "dependent" }{TEXT -1 46 ". For more information, see the \+ help page for " }{TEXT 274 9 "allvalues" }{TEXT -1 2 ". " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "allvalues(sol1[1],dependent);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 95 "The solutions from the second family are \+ real, and are the critical points we were looking for." }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 29 "allvalues(sol1[2],dependent);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 219 "A contour plot seems to indicate that ne ither critical point is a local extrema, but it is a little hard to te ll. You could refine the contour plot by changing the plot ranges or s pecifying more contours if you wished. " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "contourplot(h(x,y),x=-2..2,y=-2..0);" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 78 "Using plot3d, it is pretty clear that both critical poi nts are saddle points. " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "plot3d(h (x,y),x=-2..2,y=-2..2);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 " " }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 36 "fsolve: when the solve comm and fails" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 16 "Many times, the " } {TEXT 275 5 "solve" }{TEXT -1 59 " command can't solve the equations. \+ When this happens, the " }{TEXT 276 5 "solve" }{TEXT -1 214 " command \+ just doesn't give any output. We have also seen that sometimes the sol ve command doesn't give all the solutions. If the solve command won't \+ do the job, the best alternative is probably the fsolve command. " }} {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 232 "This com mand solves the equations numerically, using a variant of Newton's met hod. As with all numerical solution techniques, the result you obtain \+ often depends on the starting guess. For the fsolve command, you speci fy a range of " }{XPPEDIT 18 0 "x" "I\"xG6\"" }{TEXT -1 5 " and " } {XPPEDIT 18 0 "y" "I\"yG6\"" }{TEXT -1 50 " values that contain the so lution you are seeking." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 62 "Here we use the fsolve command to find the critical \+ points at " }{XPPEDIT 18 0 "x=0" "/%\"xG\"\"!" }{TEXT -1 2 ", " } {XPPEDIT 18 0 "y=2* Pi" "/%\"yG*&\"\"#\"\"\"%#PiGF&" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "x=0" "/%\"xG\"\"!" }{TEXT -1 2 ", " }{XPPEDIT 18 0 "y=3*Pi" "/%\"yG*&\"\"$\"\"\"%#PiGF&" }{TEXT -1 1 "." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 67 "fsolve(\{diff(g(x,y),x)=0,diff(g(x,y),y)= 0\},\{x,y\},\{x=-1..1,y=6..7\});" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 68 "fsolve(\{diff(g(x,y),x)=0,diff(g(x,y),y)=0\},\{x,y\}, \{x=-1..1,y=9..10\});" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" } }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 38 "global extrema on a rectangula r domain" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 68 "Suppose you were asked to find the absolute extrema of the function " }{XPPEDIT 18 0 "f(x,y) = x^2+y^2" "/-%\"fG6$%\"xG%\"yG,&*$F&\"\"#\"\"\"*$F'\"\"#F+" }{TEXT -1 18 " on the rectangle " }{XPPEDIT 18 0 "1<= x" "1\"\"\"%\"xG" } {TEXT -1 5 " and " }{XPPEDIT 18 0 "x<=2" "1%\"xG\"\"#" }{TEXT -1 5 " a nd " }{XPPEDIT 18 0 "-1<=y" "1,$\"\"\"!\"\"%\"yG" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "y<=1" "1%\"yG\"\"\"" }{TEXT -1 296 ". We know from th e first example in this worksheet that the only place where both parti al derivatives vanish is at the origin, which isn't in this rectangle. This means that the max and min have to occur on the boundary. To fin d them, it is usually helpful to plot the function on the boundary. " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 25 "Here is the function for " } {XPPEDIT 18 0 "y=-1" "/%\"yG,$\"\"\"!\"\"" }{TEXT -1 20 ". The minimum is at " }{XPPEDIT 18 0 "x=1" "/%\"xG\"\"\"" }{TEXT -1 23 " and the ma x is at x=2." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "plot (f(x,-1),x=1..2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 24 "The function is even in " }{XPPEDIT 18 0 "y" "I\"yG6\"" }{TEXT -1 18 ", so the plo t for " }{XPPEDIT 18 0 "y=1" "/%\"yG\"\"\"" }{TEXT -1 41 " is identica l to the one we just plotted." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "plot(f(x,1),x=1..2);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 4 "For " }{XPPEDIT 18 0 "x=1" "/%\"xG\"\"\"" }{TEXT -1 48 ", \+ the max is at the endpoints and the min is at " }{XPPEDIT 18 0 "y=0" " /%\"yG\"\"!" }{TEXT -1 45 ", which is easy to find by solving for wher e " }{XPPEDIT 18 0 "diff(f(1,y),y) = 0" "/-%%diffG6$-%\"fG6$\"\"\"%\"y GF*\"\"!" }{TEXT -1 1 "." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "plot(f( 1,y),y=-1..1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "solve(dif f(f(1,y),y)=0,y);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 20 "Here is the \+ plot of " }{XPPEDIT 18 0 "f(2,y)" "-%\"fG6$\"\"#%\"yG" }{TEXT -1 2 ". \+ " }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "plot(f(2,y),y=-1 ..1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 130 "The global maximum is 6 , which occurs at the points (2,-1) and (2,1) and the global minimum i s 1, which occurs at the point (1,0)." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 61 "A hint for \+ finding global extrema on a non-rectangular domain" }}{EXCHG {PARA 0 " " 0 "" {TEXT -1 212 "The Background section suggests how to proceed in finding global extrema if you have a rectangular domain, but what if \+ the domain is not a rectangle? Suppose you wanted to find the global e xtrema of the function " }{XPPEDIT 18 0 "h(x,y)" "-%\"hG6$%\"xG%\"yG" }{TEXT -1 60 " from the second example on the disk boundned by the cir cle " }{XPPEDIT 18 0 "x^2+y^2=1" "/,&*$%\"xG\"\"#\"\"\"*$%\"yG\"\"#F' \"\"\"" }{TEXT -1 260 "? The first step is to find all critical points inside the domain. From the example above, there is only one such cri tical point and it is at the origin. The next step in finding the the \+ global extrema is to examine the function on the boundary of the domai n. " }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 124 "O ne way to do this is to find a parametric description of the boundary. For example, the boundary of our disk is the circle " }{XPPEDIT 18 0 "x^2+y^2=1" "/,&*$%\"xG\"\"#\"\"\"*$%\"yG\"\"#F'\"\"\"" }{TEXT -1 45 " and it is easy to parametrize this curve as " }{XPPEDIT 18 0 "x=cos(t )" "/%\"xG-%$cosG6#%\"tG" }{TEXT -1 2 ", " }{XPPEDIT 18 0 "y=sin(t)" " /%\"yG-%$sinG6#%\"tG" }{TEXT -1 16 ". The values of " }{XPPEDIT 18 0 " h" "I\"hG6\"" }{TEXT -1 66 " on the boundary can be plotted with a com mand like the following." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 33 "plot(h(cos(t),sin(t)),t=0..2*Pi);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 92 "The usual methods of one-dimens ional calculus can now be used to find the extreme values of " } {XPPEDIT 18 0 "h" "I\"hG6\"" }{TEXT -1 18 " on the boundary. " }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}}{MARK "6" 0 } {VIEWOPTS 1 1 0 1 1 1803 }