{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 261 "" 0 1 0 0 0 0 1 0 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 0 0 1 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 267 "" 0 1 0 0 0 0 1 0 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 2010" }}{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 261 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 27 " we obtain jut one solution" }}{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 alwa ys return just this answer, but we have options to find other solution s. For one, we can we can specify a starting point for the search of \+ a stationary point:" }}{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 example 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 105 "If we pick a rectangle without a stationary poin t, maple cannot create one for us and 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 st ationary points 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);\n C := D[2,2](f)(0,0);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 23 "and then \+ we calculate 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 "As 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 obtain" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 7 "d(0,0);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 44 "while at the other stationary poin t 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 have a relative minimum at (1,1)." }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 142 "We conclude this porti on with a contour plot and with a graph of the function. The relative minimum and the saddle 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,vi ew=[-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 262 8 "Problem:" }{TEXT -1 41 " Find the minimum value 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-" }{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 pag e 723.\n" }{TEXT 263 9 "Solution:" }{TEXT -1 43 " First we define the \+ repective 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 following system of equations. We abbreviate it as LMS (Lagrang e Multiplier 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 syste m given in the book. We solve the problem with the fsolve command. N otice the braces on LMS, " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "fsolv e(\{LMS\});" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 39 "This is the soluti on found in the book." }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "# --------------" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 264 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\"\"#\"\"\"*$%\"yGF'F(*$%\"zGF'" } {TEXT -1 7 " and " }{XPPEDIT 18 0 "x+2*z = 4;" "6#/,&%\"xG\"\"\"*&\" \"#F&%\"zGF&F&\"\"%" }{TEXT -1 4 " " }}{PARA 0 "" 0 "" {TEXT 265 11 "Solution: " }{TEXT -1 214 "This leads to a problem with two const raint equations, and thus two multipliers. First wedefine the pertine nt functions. The height is given by the z-coordinate, which leads 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-" }{TEXT -1 27 " subject to the constraint " } {XPPEDIT 18 0 "2*x-3*y-4*z = 49;" "6#/,(*&\"\"#\"\"\"%\"xGF'F'*&\"\"$F '%\"yGF'!\"\"*&\"\"%F'%\"zGF'F,\"#\\" }{TEXT -1 56 ". As before, we n eed 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 straight forward (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 point 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 to find e xtrema on bounded regions (extrame on boundary or in the inside 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," }{TEXT -1 29 " subject to t he constraint " }{XPPEDIT 18 0 "x^2+y^2 <= 10;" "6#1,&*$%\"xG\"\"#\" \"\"*$%\"yGF'F(\"#5" }{TEXT -1 109 " . This is Example 3, page 723.\n We applied the maple statements directly (without defining functions f irst)." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "Maximize( 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 th e 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 "" {TEXT -1 83 "Occasionally we need to select i nitial approximations. Our example is the function" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "f := (x,y) -> cos(x)*sin(y);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "plot3d(f,-5..5,-5..5,axes=normal);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 67 "The graph shows that f attains its maximum at several points. The " }{TEXT 266 8 "Maximize" }{TEXT -1 21 " command takes us to " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "Maximi ze(f(x,y));" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 22 "This translates in to " }{XPPEDIT 18 0 "x = 0;" "6#/%\"xG\"\"!" }{TEXT -1 7 " and " } {XPPEDIT 18 0 "y = Pi/2;" "6#/%\"yG*&%#PiG\"\"\"\"\"#!\"\"" }{TEXT -1 36 " . But the function equas 1 at " }{XPPEDIT 18 0 "x = Pi;" "6# /%\"xG%#PiG" }{TEXT -1 6 " and " }{XPPEDIT 18 0 "y = -Pi/2;" "6#/%\"y G,$*&%#PiG\"\"\"\"\"#!\"\"F*" }{TEXT -1 45 " as well. By selecting x =3 and y=-1.5, the " }{TEXT 267 12 "Maximization" }{TEXT -1 41 " routi ne takes us to the desired point. " }{MPLTEXT 1 0 1 " " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 44 "Maximize(f(x,y), initialpoint=\{x=3 ,y=-1.5\});" }}}{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 }