{VERSION 6 0 "IBM INTEL NT" "6.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 "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 256 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 263 "" 0 1 0 0 0 0 1 0 0 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 0 }{CSTYLE "" -1 267 "" 0 1 0 0 0 0 0 1 0 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 0 }{CSTYLE "" -1 269 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 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 "Heading 1" -1 3 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 8 4 1 0 1 0 2 2 0 1 }{PSTYLE "Normal" -1 256 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT 256 25 "Several Variables, Part 2" }}{PARA 256 "" 0 "" {TEXT -1 10 "March 2009" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 59 "This is a continuation of the Several Variables worksheet. " }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{SECT 1 {PARA 3 "" 0 " " {TEXT -1 44 "Stationary Points, Extrema and Saddle Points" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "restart; with(plots):" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 172 "We search for stationary points, and onc e they are found, we will decide whether we have a maximum, a minimum \+ or a saddle point. The example throughout is the function " } {XPPEDIT 18 0 "f(x,y) = x^3+y^3-3*x*y;" "6#/-%\"fG6$%\"xG%\"yG,(*$F'\" \"$\"\"\"*$F(F+F,*(F+F,F'F,F(F,!\"\"" }{TEXT -1 52 " .\nFirst we defin e f once and for all ( or until we " }{TEXT 263 7 "restart" }{TEXT -1 1 ")" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "f := (x,y) -> x^3 + y^3 -3* x*y;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 33 "The first partial derivat ives are" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 27 "D[1](f)(x,y);\nD[2](f)( x,y);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 95 "We have to set both quan tities to zero, and then solve for x and y. This can be done with the " }{TEXT 257 5 "solve" }{TEXT -1 8 " or the " }{TEXT 258 6 "fsolve" } {TEXT -1 93 " command. The key is to enclose the two equations and th e two unknowns with curly brackets. " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 48 "solve(\{D[1](f)(x,y)=0, D[2](f)(x,y)=0\} , \{x,y\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 42 "The first two pairs contain our solutions ." }}{PARA 0 "" 0 "" {TEXT -1 5 "With " }{TEXT 259 6 "fsolve" }{TEXT -1 11 " we obtain " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "fsolve(\{D[1] (f)(x,y)=0, D[2](f)(x,y)=0\} , \{x,y\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 260 6 "fsolve" }{TEXT -1 177 " as such will always return just t his answer, but we have options to find other solutions. For one, we \+ can we can specify a starting point for the search of a stationary poi nt:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }{MPLTEXT 1 0 57 "fsolve(\{D[1](f )(x,y)=0, D[2](f)(x,y)=0\} , \{x=0.8,y=1.2\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 118 "Secondly, we can specify a search region; for examp le we can look for solutions in the rectangle [0.5 , 2] x [-2 , 2]:" } }{PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "fsolve(\{D[1](f)(x,y)=0, D[2](f)(x ,y)=0\} , \{x=0.5..2,y=-2..2\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 103 "If we pick a rectangle without a stationary point, maple cannot c reate one for us. We get the response" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 65 "fsolve(\{D[1](f)(x,y)=0, D[2](f)(x,y)=0\} , \{x=-2..-0.01,y=-1 ..1\});" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 85 "The classification of the stationary poin ts we can do step by step. First we define " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "A := D[1,1](f)(0,0);\nB := D[1,2](f)(0,0);\nC := D[2, 2](f)(0,0);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 23 "and then we calcul ate d" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "A*C-B^2;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 83 "In this case we see that we have a saddle point at the origin, since d is negative." }}{PARA 0 "" 0 "" {TEXT -1 67 "A s an alternative, we could calculate d as a function of x and y. " }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 61 "d := (x,y) -> D[1,1](f)(x,y)*D[2,2] (f)(x,y)-D[1,2](f)(x,y)^2;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "d(x,y);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 23 "At the origin we ob tain" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "d(0,0);" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 44 "while at the other stationary point we have " }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "d(1,1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "Combined with " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "D[1, 1](f)(1,1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 48 "we see that we hav e a relative minimum at (1,1)." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 142 "We conclude this portion with a contour \+ plot and with a graph of the function. The relative minimum and the s addle point are clearly visible." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 120 "contourplot(f,-2..2,-2..2,contours=[-2, -1, -0.9, -0.5, 0, 1, 2], numpoints=2000,filledregions=true,coloring=[red,blue]);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 58 "plot3d(f,-2..2,-2..2,view=[-2..2,-2 ..2,-2..2],axes=boxed);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 " " 0 "" {TEXT -1 20 "Lagrange Multipliers" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "restart;\nwith(plots):" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 266 8 "Problem:" }{TEXT -1 41 " Find the minimum value of the fu nction " }{XPPEDIT 18 0 "f(x,y,z) = 2*x^2+y^2+3*z^2;" "6#/-%\"fG6%%\" xG%\"yG%\"zG,(*&\"\"#\"\"\"*$)F'F,F-F-F-*$)F(F,F-F-*&\"\"$F-*$)F)F,F-F -F-" }{TEXT -1 30 " subject to the constraint " }{XPPEDIT 18 0 "2*x -3*y-4*z = 49;" "6#/,(*&\"\"#\"\"\"%\"xGF'F'*&\"\"$F'%\"yGF'!\"\"*&\" \"%F'%\"zGF'F,\"#\\" }{TEXT -1 33 ".\nThis is Example 2 on page 723.\n " }{TEXT 267 9 "Solution:" }{TEXT -1 43 " First we define the repectiv e functions " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 66 "f := (x,y,z) -> 2 *x^2 +y^2 +3*z^2;\ng := (x,y,z) -> 2*x -3*y - 4*z;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 133 "The Lagrange multiplier methods leads to the fol lowing system of equations. We abbreviate it as LMS (Lagrange Multip lier System). " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 136 "LMS := \+ \nD[1](f)(x,y,z)=lambda*D[1](g)(x,y,z),\nD[2](f)(x,y,z)=lambda*D[2](g) (x,y,z),\nD[3](f)(x,y,z)=lambda*D[3](g)(x,y,z),\ng(x,y,z) = 49;" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 123 "This is the resulting system give n in the book. We solve the problem with the fsolve command. Notice \+ the braces on LMS, " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "fsolve(\{LM S\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 39 "This is the solution fou nd in the book." }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "# --------------" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 268 8 "Problem:" }{TEXT -1 94 " Find the highest and lowest point on \+ the curve defined by the intersection of the surfaces " }{XPPEDIT 18 0 "x^2+y^2 = z^2;" "6#/,&*$)%\"xG\"\"#\"\"\"F)*$)%\"yGF(F)F)*$)%\"zGF( F)" }{TEXT -1 7 " and " }{XPPEDIT 18 0 "x+2*z = 4;" "6#/,&%\"xG\"\" \"*&\"\"#F&%\"zGF&F&\"\"%" }{TEXT -1 4 " " }}{PARA 0 "" 0 "" {TEXT 269 11 "Solution: " }{TEXT -1 214 "This leads to a problem with two c onstraint equations, and thus two multipliers. First wedefine the per tinent functions. The height is given by the z-coordinate, which lead s to the definition of f as given below." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 73 "f := (x,y,z) -> z;\ng := (x,y,z) -> x^2+y^2-z^2;\nh : = (x,y,z) -> x + 2*z; " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 56 "A graph helps to understand the problem a little better." }}{PARA 0 "> " 0 " " {MPLTEXT 1 0 127 "implicitplot3d([g(x,y,z)=0, h(x,y,z) = 4],x=-6..2, y=-4..4, z=0..8, color=[red,blue], axes=normal, numpoints=2000,style=h idden);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 217 "LMS := \nD[1](f )(x,y,z) = lambda*D[1](g)(x,y,z) + mu*D[1](h)(x,y,z), \nD[2](f)(x,y,z) = lambda*D[2](g)(x,y,z) + mu*D[2](h)(x,y,z),\nD[3](f)(x,y,z) = lambda *D[3](g)(x,y,z) + mu*D[3](h)(x,y,z),\ng(x,y,z) = 0,\nh(x,y,z) = 4; " } }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "fsolve(\{ LMS \},\{x,y,z,l ambda,mu\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 195 "This is a first \+ solution, and judging by the graph (z=4), we have identified the highe st point. We include estimates for x and y in the fsolve statement be low, in order to find the lowest point." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "fsolve(\{ LMS \},\{x=2,y=0,z,lambda,mu\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 89 "Result. The highst point is located at (-4,0,4) \+ and the lowest point is at (4/3, 0,4/3)." }}{PARA 0 "" 0 "" {TEXT -1 101 "Quick checks: (substitute the points into the constaint functions , g must be zero and h must be four)" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 50 "g(-4,0,4); g(4/3,0,4/3);\nh(-4,0,4); h(4/3,0,4/3); " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}} {SECT 1 {PARA 3 "" 0 "" {TEXT -1 24 "The Optimization Package" }} {EXCHG {PARA 0 "" 0 "" {TEXT -1 63 "Here we rework the problems using \+ maple's optimization package." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "re start;\nwith(Optimization);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 38 "We find the minimum of the function " }{XPPEDIT 18 0 "f(x,y,z) = 2*x^2 +y^2+3*z^2;" "6#/-%\"fG6%%\"xG%\"yG%\"zG,(*&\"\"#\"\"\"*$)F'F,F-F-F-*$ )F(F,F-F-*&\"\"$F-*$)F)F,F-F-F-" }{TEXT -1 27 " subject to the constra int " }{XPPEDIT 18 0 "2*x-3*y-4*z = 49;" "6#/,(*&\"\"#\"\"\"%\"xGF'F'* &\"\"$F'%\"yGF'!\"\"*&\"\"%F'%\"zGF'F,\"#\\" }{TEXT -1 56 ". As befor e, we need to define functions f and g: " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 66 "f := (x,y,z) -> 2*x^2 +y^2 +3*z^2;\ng := (x,y,z) -> 2 *x -3*y - 4*z;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 77 "Minimization is straightforward (notice that we need braces on the constaint)" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 35 "Minimize( f(x,y,z), \{g(x,y,z)=49\} );" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 76 "Reworking the second example (highest and lowest p oint on a curve) leads to " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 73 "f := \+ (x,y,z) -> z;\ng := (x,y,z) -> x^2+y^2-z^2;\nh := (x,y,z) -> x + 2*z; \+ " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 14 "Highest point:" }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 48 "Maximize( f(x,y,z), \{g(x,y,z)=0, h(x,y,z) = 4 \});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 13 "Lowest point:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 48 "Minimize( f(x,y,z), \{g(x,y,z)=0, h(x,y,z) \+ = 4\});" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 165 "The optimization package is convenient t o find extrema on bounded regions (extrame on boundary or in the insid e of the region). Here we have inequality constraints." }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 38 "Example: Find the extreme values of " } {XPPEDIT 18 0 "f(x,y) = x^2+2*y^2-2*x+3;" "6#/-%\"fG6$%\"xG%\"yG,**$)F '\"\"#\"\"\"F-*&F,F-*$)F(F,F-F-F-*&F,F-F'F-!\"\"\"\"$F-" }{TEXT -1 29 " subject to the constraint " }{XPPEDIT 18 0 "x^2+y^2 <= 10;" "6#1,& *$)%\"xG\"\"#\"\"\"F)*$)%\"yGF(F)F)\"#5" }{TEXT -1 109 " . This is Ex ample 3, page 723.\nWe applied the maple statements directly (without \+ defining functions first)." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "Maxim ize( x^2+2*y^2-2*x+3 , \{x^2 + y^2 <= 10\});" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "Minimize( x^2+2*y^2-2*x+3 , \{x^2 + y^2 <= 10\}) ;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 88 "The maximizer (-1,3) lies on the boundary, and the minimizer (1,0) is inside the region." }}{PARA 0 "" 0 "" {TEXT -1 1 " " }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}} }{MARK "0 1 0" 10 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }