(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 4.0, MathReader 4.0, or any compatible application. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 8303, 256]*) (*NotebookOutlinePosition[ 9251, 287]*) (* CellTagsIndexPosition[ 9207, 283]*) (*WindowFrame->Normal*) Notebook[{ Cell[BoxData[ \(Off[General::spell]\)], "Input", Background->RGBColor[1, 1, 0]], Cell[TextData[{ StyleBox["Math 2443: Calculus & Analytic Geometry IV", FontSize->12, FontColor->GrayLevel[0]], "\n", StyleBox["The Geometry of Lagrange Multipliers", FontSize->24], "\n", StyleBox["by Michael Hofer (University of Graz) and TJ Murphy", FontSize->12, FontColor->GrayLevel[0]] }], "Text", CellFrame->{{0, 0}, {0, 3}}, FontSize->24, FontColor->RGBColor[1, 0, 1]], Cell[TextData[StyleBox["Shows the geometry of using Lagrange multipliers to \ optimize a surface subject to one constraint.", FontSlant->"Plain", FontColor->GrayLevel[0]]], "Text", CellFrame->{{0, 0}, {0, 3}}, FontColor->RGBColor[1, 0, 1]], Cell[CellGroupData[{ Cell["Visualizing the Surface and the Contraint Curve", "Text", CellFrame->{{0, 0}, {0, 3}}, FontSize->18, Background->RGBColor[1, 0, 1]], Cell[CellGroupData[{ Cell["\<\ This set of commands draws nice axes and places them in the \ standard position.\ \>", "Text"], Cell[BoxData[ \(range = 10; \nviewpoint = ViewPoint -> {3.132, \ 1.199, \ 0.447}; \n axes = Graphics3D[{Line[{{0, 0, 0}, { .4*range, 0, 0}}], Line[{{0, 0, 0}, {0, .3*range, 0}}], Line[{{0, 0, 0}, {0, 0, range}}]}]; \n labels = Graphics3D[{Text["\", { .5*range, 0, 0}], Text["\", {0, .4*range, 0}], Text["\", {0, 0, 1.1*range}]}]; \n axes3D = Show[axes, labels, viewpoint, Boxed -> False]; \)], "Input", Background->RGBColor[1, 1, 0]] }, Open ]], Cell[CellGroupData[{ Cell[TextData[{ "Consider the function, ", Cell[BoxData[ \(TraditionalForm\`f(x, y) = 2 x\^2 + x + y\^2 - 2\)]], ", called the \"objective function\", whose graph is the surface below." }], "Text"], Cell[BoxData[ \(f[x_, y_] = 2\ x^2\ + x\ + y^2\ - 2; \n surface = Plot3D[f[x, y], {x, \(-2.1\), 2.1}, {y, \(-2.1\), 2.1}, PlotRange -> {\(-3\), 17}, Mesh -> False]; \n Show[surface, axes3D, BoxRatios -> {1, 1, 1}, \ Axes -> False, Boxed -> False, viewpoint]; \)], "Input", Background->RGBColor[1, 1, 0]] }, Open ]], Cell[CellGroupData[{ Cell[TextData[{ "Then add in the circle, ", Cell[BoxData[ \(TraditionalForm\`x\^2 + y\^2 = 4\)]], ", called the constraint curve." }], "Text"], Cell[BoxData[ \(constraint = ParametricPlot3D[{2 Cos[t], 2 Sin[t], 0}, {t, 0, 2\ Pi}]; \n Show[surface, constraint, axes3D, \ BoxRatios -> {1, 1, 1}, Axes -> False, Boxed -> False, viewpoint]; \)], "Input", Background->RGBColor[1, 1, 0]] }, Open ]], Cell[CellGroupData[{ Cell[TextData[{ "In 3-space the constraint equation ", Cell[BoxData[ \(TraditionalForm\`x\^2 + y\^2 = 4\)]], " defines a cylinder.Intersecting this cylinder with the surface gives us a \ curve in 3-space." }], "Text"], Cell[BoxData[ \(schnittkurve = ParametricPlot3D[{2\ Cos[t], \ 2\ Sin[t], 8 Cos[t]\^2 + 2 Cos[t] + 4\ Sin[t]\^2 - 2}\ , {t, 0, 2\ Pi}, AxesLabel -> {x, y, z}, ViewPoint -> {\(-1.648\), \ \(-2.593\), \ 1.418}]; \n Show[surface, schnittkurve, constraint, axes3D, BoxRatios -> {1, 1, 1}, Axes -> False, Boxed -> False, viewpoint]; \)], "Input", Background->RGBColor[1, 1, 0]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Looking at this intersection curve in 3-space, it appears that the \ function attains two local maxima and two local minima along the constraint \ curve.\ \>", "Text"], Cell[BoxData[ \(\(\nShow[schnittkurve, axes3D, BoxRatios -> {1, 1, 1}, Axes -> False, Boxed -> False, ViewPoint -> {3.147, \ 1.133, \ 0.514}]; \n Show[schnittkurve, axes3D, BoxRatios -> {1, 1, 1}, Axes -> False, Boxed -> False, ViewPoint -> {\(-1.767\), \ 2.851, \ 0.447}]; \)\)], "Input", Background->RGBColor[1, 1, 0]] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["Relationship to Contour Diagram", "Text", CellFrame->{{0, 0}, {0, 3}}, FontSize->18, Background->RGBColor[1, 0, 1]], Cell[CellGroupData[{ Cell[TextData[{ "Another way to study the method of Lagrange multipliers is throuogh the \ objective function's level curves (i.e., the curves in the contour diagram). \ Here ", StyleBox["Mathematica", FontSlant->"Italic"], " uses shading to to indicate height (darker represents lower on the \ z-axis)." }], "Text"], Cell[BoxData[ \(\(levelcurves = ContourPlot[2\ x^2\ + x\ + y^2\ - 2, {x, \(-3\), 3}, {y, \(-3\), 3}, \ Contours -> 10, PlotPoints -> 45]; \)\)], "Input", Background->RGBColor[1, 1, 0]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ In our example, the constraint equation can also be represented in \ two dimensions. So here we look at the relationship between the level curves \ of the surface and the constraint equation.\ \>", "Text"], Cell[BoxData[ \(kreis = ParametricPlot[{2 Cos[t], 2 Sin[t]}, {t, 0, 2\ Pi}, \ PlotRange -> {{\(-3\), 3}, {\(-3\), 3}}, AspectRatio -> Automatic, PlotStyle\ -> \n\ \ \ \ \ {RGBColor[1, \ 0, \ 0], Thickness[ .01]}]; \nShow[levelcurves, kreis]; \)], "Input", Background->RGBColor[1, 1, 0]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Trace with your finger along the constraint curve. Note how the \ objective function's values change as you do that. For example, traveling \ along the constraint from the point (2,0), in either direction, the objective \ function's values decrease (remember that darker shading represents values \ farther down the z-axis). So (2,0) yields a local maximum with respect to \ travel on the constraint curve. Thus, it turns out that an extreme point of our 3D curve occurs when the \ constraint equation (circle) is tangent to a level curve. This observation \ leads us to note that the gradient vector of the objective function is \ parallel to the gradient of the constraint (since both are perpendicular to \ the tangent vector at the point of tangency between the constraint curve and \ the level curve).\ \>", "Text"], Cell[BoxData[ \(lagrangeCurves = ContourPlot[2\ x^2\ + x\ + y^2\ - 2, {x, \(-3\), 3}, {y, \(-3\), 3}, \ Contours -> {\(-17\)/8 + .1, 7/4, 4, 8}, PlotPoints -> 45]; \n Show[lagrangeCurves, kreis]; \)], "Input", Background->RGBColor[1, 1, 0]] }, Open ]] }, Closed]], Cell[TextData[{ "This work is part of the Multivariable Calculus with ", StyleBox["Mathematica", FontSlant->"Italic"], " Project at the University of Oklahoma " }], "Text", CellFrame->{{0, 0}, {0, 3}}, FontSize->10] }, FrontEndVersion->"4.0 for Macintosh", ScreenRectangle->{{0, 832}, {0, 604}}, WindowToolbars->"RulerBar", CellGrouping->Manual, WindowSize->{520, 509}, WindowMargins->{{Automatic, 34}, {Automatic, 27}}, PrintingCopies->1, PrintingPageRange->{1, Automatic}, MacintoshSystemPageSetup->"\<\ 00l0005X0FP000003^P;H?oCokH?B`^Z;085:0?l0@00005X0]0000003^PF`003 1@00I00200000@0200000BL?004000]cOM0000000000030001000000000@0?oC of`?BaMD0200000000400000000001T1\>" ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[1717, 49, 85, 2, 43, "Input"], Cell[1805, 53, 410, 14, 85, "Text"], Cell[2218, 69, 247, 5, 41, "Text"], Cell[CellGroupData[{ Cell[2490, 78, 143, 3, 55, "Text"], Cell[CellGroupData[{ Cell[2658, 85, 104, 3, 30, "Text"], Cell[2765, 90, 509, 9, 187, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[3311, 104, 210, 5, 46, "Text"], Cell[3524, 111, 343, 7, 107, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[3904, 123, 154, 5, 30, "Text"], Cell[4061, 130, 263, 5, 107, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[4361, 140, 229, 6, 46, "Text"], Cell[4593, 148, 426, 8, 169, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[5056, 161, 177, 4, 46, "Text"], Cell[5236, 167, 347, 6, 139, "Input"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[5632, 179, 127, 3, 52, "Text"], Cell[CellGroupData[{ Cell[5784, 186, 326, 8, 64, "Text"], Cell[6113, 196, 209, 4, 75, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[6359, 205, 215, 4, 46, "Text"], Cell[6577, 211, 325, 6, 107, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[6939, 222, 831, 14, 174, "Text"], Cell[7773, 238, 270, 5, 107, "Input"] }, Open ]] }, Closed]], Cell[8070, 247, 229, 7, 37, "Text"] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)