Chapter 4: Partial Differentiation
Section 4.9: Constrained Optimization
Example 4.9.4
A pentagon is formed from a rectangle surmounted by an isosceles triangle.
What dimensions give the pentagon least perimeter if the area is fixed at the value 50?
Solution
Mathematical Solution
From the labeled diagram of a pentagon in Figure 4.9.4(a), deduce that the objective function, the perimeter, is
fx,y,z=2⁢x2+z2+⁢x+ y
and that the area function is
Ax,y,z=2⁢x⁢y+x⁢z
so that the constraint is g=A−50.
The Lagrange multiplier method, whose equations are ∇f=λ ∇g and g=0, requires that the following equations be solved for x,y,z,λ.
use plots in module() local p1,p2,p3,p4; p1 := plot([[0,0],[6,0],[6,3],[3,5],[0,3],[0,0]], color=black): p2 := plot({[[0,3],[6,3]],[[3,5],[3,3]]}, linestyle = 3, color=black): p3 := textplot({[1.5,2.7,x],[4.5,2.7,x],[3.2,4,z],[5.1,4.2,typeset(sqrt(z^2 + x^2))], [.3,1.5,y],[5.7,1.5,y], [3,.3,typeset(2*x)]}, font=[TIMES,ROMAN,12]): p4:=display([p1,p2,p3],axes=none); print(p4); end module: end use:
Figure 4.9.4(a) Labeled pentagon
−2⁢x⁢y−x⁢z+50,−2⁢y+z⁢λ+2⁢xx2+z2+2,−2⁢λ⁢x+2,−x⁢λ+2⁢zx2+z2
There are two solutions for x,y,z, namely,
−5−5 3,−103⁢3,5+53⁢3 and 5 3−5,103⁢3,5−53⁢3
The second solution in which all the coordinates are positive is taken as the "correct" one, and for this solution: λ=1+3/10 and f=101+3≐27.32.
Maple Solution - Interactive
Initialize
Tools≻Load Package: Student Multivariate Calculus
Loading Student:-MultivariateCalculus
Context Panel: Assign Name
f=2⁢x2+z2+⁢x+ y→assign
g=2⁢x⁢y+x⁢z−50→assign
Apply the LagrangeMultipliers command in the Student MultivariateCalculus package, captured in the task template. See Table 4.9.4(a).
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:
Table 4.9.4(a) The Lagrange Multiplier Method task template
The exact expressions generated by the task template have been converted to floating-point form. These exact expressions appear below in the several calculations that implement the Lagrange multiplier method in different ways.
Implement the Lagrange multiplier method via first principles
F=f−λ g→assign
Write F and press the Enter key.
Context Panel: Student Multivariate Calculus≻Differentiate≻Gradient
Context Panel: Conversions≻To List
Context Panel: Solve≻Solve (explicit)
Context Panel: Select Element≻2 (Caution - Maple could change ordering of solutions!)
F
−2⁢x⁢y+x⁢z−50⁢λ+2⁢x2+z2+2⁢x+2⁢y
→gradient
→to list
−2⁢x⁢y−x⁢z+50,−2⁢y+z⁢λ+2⁢xx2+z2+2,−2⁢λ⁢x+2,−x⁢λ+2⁢zx2+z2
→solve
λ=110−110⁢3,x=−5−5⁢3,y=−103⁢3,z=5+53⁢3,λ=110+110⁢3,x=5⁢3−5,y=103⁢3,z=5−53⁢3
→select entry 2
λ=110+110⁢3,x=5⁢3−5,y=103⁢3,z=5−53⁢3
Optimization Assistant
The Optimization Assistant is no longer listed in Tools≻Assistants. It is now found in Tools≻Tutors≻Optimization
A numeric solution is available via the , launched from the Context Panel on the sequence f,g=0.
Figure 4.9.4(b) shows the Optimization Assistant finding the minimum of 101+3≐27.3 at
53−5,103,5−53 ≐ 3.66,5.77,2.11
Figure 4.9.4(b) Constrained maximum
Maple Solution - Coded
Install the Student MultivariateCalculus package.
withStudent:-MultivariateCalculus:
Define f, the objective function.
f≔2⁢x2+z2+⁢x+ y:
Define g, the constraint function.
g≔2⁢x⁢y+x⁢z−50:
Implement the Lagrange multiplier method
Invoke the LagrangeMultipliers command from the Student MultivariateCalculus package.
LagrangeMultipliersf,g,x,y,z
2129,1429,−2829
Add the "detailed" option to the LagrangeMultipliers command.
S≔simplifyLagrangeMultipliersf,g,x,y,z,output=detailed: print~S
x=−5−5⁢3,y=−103⁢3,z=5+53⁢3,λ1=110−110⁢3,2⁢x2+z2+2⁢x+2⁢y=10−10⁢3
Implement the Lagrange multiplier method from first principles
Define F.
F≔f− λ g:
Use the Gradient command to obtain ∇f−λ ∇g.
Use the Equate command to equate each component of ∇f−λ ∇g to zero.
Use the solve command to obtain the solutions of the equations in ∇f−λ ∇g=0.
Q≔solveEquateGradientF,x,y,z,λ,0,0,0,0,x,y,z,λ,explicit: print~Q
x=5⁢3−5,y=103⁢3,z=5−53⁢3,λ=110+110⁢3
<< Previous Example Section 4.9 Next Example >>
© 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