Chapter 4: Partial Differentiation
Section 4.10: Optimization on Closed Domains
Example 4.10.6
Find the extreme values of the function fx,y=3⁢x2+3⁢x⁢y+2⁢y2+5⁢x−4 y on the domain R consisting of the interior and boundary of the ellipse whose equation is 2⁢x2−4⁢x⁢y+3⁢y2+4⁢x−5⁢y−1=0.
Solution
Mathematical Solution
The unconstrained extrema are found by solving the equations fx=fy=0. Thus, the equations
6⁢x+3⁢y+5=0,3⁢x+4⁢y−4=0
are solved for x,y = −32/15,13/5, which is outside R.
A search along the constraint can be implemented by the Lagrange multiplier technique. The equations Fx=Fy=Fλ=0 that result from defining F=f−λ g are
4 x−6 y+5⁢λ+3⁢x+4⁢y−4=0
4⁢y−4 x−4⁢λ+6⁢x+3⁢y+5=0
2 x2−4 x y+3 y2+4 x−5 y−1=0
There are four exceedingly cumbersome exact solutions of these equations, so it is imperative that they be solved numerically for the following triples x,y,fx,y.
−0.06694753468,−0.2319153335,0.7605175013
−1.056335968,1.136359769,−7.498087925
−2.609293059,−1.213832530,24.68260883
1.679706471,2.119055768,28.04552051
The first point is a relative minimum; the second, is the absolute minimum; the third, is a relative maximum; and the fourth, is the absolute maximum.
Figure 4.10.6(a) shows that portion of the surface z=f that is defined on R, the interior and the boundary of the ellipse g=0.
The domain R appears beneath the surface z=f, and the four extrema on the lift of the ellipse g=0 to the surface z=f are drawn as red dots on that bounding space curve.
use plots in module() local P1,P2,P3,P4,P5,p1,p2,p3,p4,f,g,b1,b2; f:=3*x^2+3*x*y+2*y^2+5*x-4*y; g:=2*x^2-4*x*y+3*y^2+4*x-5*y-1; b1:=(2/3)*x+5/6+(1/6)*sqrt(-8*x^2-8*x+37); b2:=(2/3)*x+5/6-(1/6)*sqrt(-8*x^2-8*x+37); p1:=[-0.6694753468e-1, -.2319153335, .7605175013]; p2:=[-1.056335968, 1.136359769, -7.498087925]; p3:=[-2.609293059, -1.213832530, 24.68260883]; p4:=[1.679706471, 2.119055768, 28.04552051]; P1:=intersectplot(z=f,g=0,x=-3..2,y=-2..3,z=-8..30,grid=[10,10,10],color=black,thickness=3): P2:=pointplot3d([p1,p2,p3,p4],symbol=solidsphere,symbolsize=25,color=red): P3:=plot3d(f,x=-3..2,y=b2..b1,style=surfacecontour,lightmodel=none); P4:=plot3d(-10,x=-2.8..1.8,y=b2..b1,lightmodel=none); P5:=display(P1,P2,P3,P4,orientation=[125,60,0],axes=frame,tickmarks=[7,7,5],view=-10..30); print(P5); end module: end use:
Figure 4.10.6(a) z=f, R, and the four extrema
Maple Solution - Interactive
Initialize
Context Panel: Assign Name
f=3⁢x2+3⁢x⁢y+2⁢y2+5⁢x−4 y→assign
g=2⁢x2−4⁢x⁢y+3⁢y2+4⁢x−5 y−1.0→assign
Obtain any unconstrained extrema
Calculus palette: Partial-differentiation operator Press the Enter key.
Context Panel: Solve≻Solve (The point −32/15,13/5 is outside R.)
∂∂ x f=0,∂∂ y f=0
→solve
x=−3215,y=135
Apply the Lagrange multiplier method via the task template
Tools≻Tasks≻Browse:
Calculus - Multivariate≻Optimization≻Lagrange Multiplier Method
Method of Lagrange Multipliers
Enter objective function f
Enter constraints gk=0,k=1,…,entered as functions g1,g2,…
Enter coordinate variables, separated by commas:
The Lagrange multiplier method from first principles
F=f−λ g→assign
Context Panel: Assign to a Name≻Q
∂∂ x F=0,∂∂ y F=0,∂∂ λ F=0
−4⁢x−4⁢y+4⁢λ+6⁢x+3⁢y+5=0,−−4⁢x+6⁢y−5⁢λ+3⁢x+4⁢y−4=0,−2⁢x2+4⁢x⁢y−3⁢y2−4⁢x+5⁢y+1.0=0
→assign to a name
Q
Type the name Q and press the Enter key.
Context Panel: Solve≻Numerically Solve from point Take λ,x,y in succession as 0,0,0, 9,1,2, 0,−1,1, 9,−2,−1, for example.
Context Panel: Assign to a Name≻s[k], k=1,…,4
λ=0.8374842625,x=−0.06694753468,y=−0.2319153335
s1
λ=9.558271317,x=1.679706471,y=2.119055768
s2
λ=−0.4341139647,x=−1.056335968,y=1.136359769
s3
λ=9.038358386,x=−2.609293059,y=−1.213832530
s4
Display the four solutions in the form x,y,fx,y
Expression palette: Evaluation template Context Panel: Evaluate and Display inline
x,y,fx=a|f(x)s1 = −0.06694753468,−0.2319153335,0.7605175013
x,y,fx=a|f(x)s2 = 1.679706471,2.119055768,28.04552051
x,y,fx=a|f(x)s3 = −1.056335968,1.136359769,−7.498087925
x,y,fx=a|f(x)s4 = −2.609293059,−1.213832530,24.68260883
Numeric solution via the
The Optimization Assistant is no longer listed in Tools≻Assistants. It is now found in Tools≻Tutors≻Optimization
Type f and press the Enter key. Context Panel: Optimization≻Optimization Assistant
Add the constraint shown in Figure 4.10.6(c).
Figure 4.10.6(c) shows the Optimization Assistant finding the global minimum.
Figure 4.10.6(d) shows the Optimization Assistant finding the global maximum.
Figure 4.10.6(b) shows the surface z=f with the lift of the ellipse g=0 superimposed.
Figure 4.10.6(b) Surface z=f and constraint
Figure 4.10.6(c) Finding the minimum
Figure 4.10.6(d) Finding the maximum
Maple Solution - Coded
Install the Student MultivariateCalculus package.
withStudent:-MultivariateCalculus:
Define the objective function f.
f≔3 x2+3⁢x⁢y+2⁢y2+5⁢x−4 y:
Define the constraint function g.
g≔2⁢x2−4⁢x⁢y+3⁢y2+4⁢x−5 y−1.0:
Use the diff command to obtain the equations fx=fy=0, and the solve command to obtain their solution.
The point −32/15,13/5 is outside R.
solvedifff,x=0,difff,y=0
Use the Lagrange multiplier method to search along the constraint ellipse
Apply the LagrangeMultipliers command to obtain the extrema along the ellipse. Because g contains a floating-point coefficient, the computations are strictly numeric.
Use print tilde to display the solutions one beneath the other.
S≔LagrangeMultipliersf,g,x,y,output=detailed: print~S
x=1.679706471,y=2.119055768,λ1=9.558271317,3⁢x2+3⁢x⁢y+2⁢y2+5⁢x−4⁢y=28.04552051
Implement the Lagrange multiplier method from first principles
Define F.
F≔f−λ g:
Use the diff command to obtain the equations Fx=Fy=Fλ=0.
q≔diffF,x=0,diffF,y=0,diffF,λ=0
−−4⁢x+6⁢y−5⁢λ+3⁢x+4⁢y−4=0,−4⁢x−4⁢y+4⁢λ+6⁢x+3⁢y+5=0,−2⁢x2+4⁢x⁢y−3⁢y2−4⁢x+5⁢y+1.0=0
Use the fsolve command to obtain numeric solutions of the equations Fx=Fy=Fλ=0.
s1≔fsolveq,x,y,λ,λ=0..1
s2≔fsolveq,x,y,λ,λ=−1..0
s3≔fsolveq,x,y,λ,λ=9..9.5
s4≔fsolveq,x,y,λ,λ=9.5..10
Use a do-loop containing the eval command to evaluate x,y, and f at the four solutions just obtained.
for k from 1 to 4 do evalx,y,f,sk; end do
Obtain the extrema numerically with the Maximize and Minimize commands in the Optimization package.
Optimization:-Maximizef,g=0
28.0455205089150184,x=1.67970647057851,y=2.11905576750032
Optimization:-Minimizef,g=0
0.760517501131491080,x=−0.0669475447599069,y=−0.231915341172423
<< Previous Example Section 4.10 Next Section >>
© Maplesoft, a division of Waterloo Maple Inc., 2024. All rights reserved. This product is protected by copyright and distributed under licenses restricting its use, copying, distribution, and decompilation.
For more information on Maplesoft products and services, visit www.maplesoft.com
Download Help Document