Chapter 4: Partial Differentiation
Section 4.9: Constrained Optimization
|
Example 4.9.10
|
|
Find the extrema of subject to the constraints and .
|
|
|
|
Solution
|
|
|
Mathematical Solution
|
|
•
|
Figure 4.9.10(a) shows the constraint as the red cylinder, the constraint as the green plane, and the curve of intersection in black.
|
•
|
The constrained optimization problem consists in finding the extreme values of the function along the black curve of intersection of the constraints.
|
|
•
|
Figure 4.9.10(b) shows the level surfaces of at the two extrema on the intersection of the constraints. At each extrema, is drawn in black, , in red, and , in green.
|
•
|
At each extrema, lies in the plane determined by the vectors and .
|
|
>
|
use plots, Student:-VectorCalculus in
module()
local p1,p2,p3,p4,g,h;
g:=3*x^2+2*y^2=4;
h:=4*x+3*z = 1;
p2:=implicitplot3d([g,h],x=-2..3,y=-2..2,z=-3..3,style=surface,color=[red,green],transparency=[0,.3]);
p3:=intersectplot(g,h,x=-2..2,y=-2..2,z=-3..3,color=black,thickness=3);
p4:=display(p2,p3,scaling=constrained,axes=frame,labels=[x,y,z],view=[-2..3,-2..2,-3..3],tickmarks=[5,7,9],orientation=[55,80,0]);
print(p4);
end module:
end use:
|
|
Figure 4.9.10(a) Constraints and
|
|
|
|
>
|
use plots, Student:-VectorCalculus in
module()
local p1,p2,p3,p4,g,h,M,GfM,GgM,GhM,m,Gfm,Ggm,Ghm,fM,fm,f,p1M,p1m;
g:=3*x^2+2*y^2=4;
h:=4*x+3*z = 1;
f:=2*x+3*y-5*z;
fM:=1/9*sqrt(9570)-5/3;
fm:=-1/9*sqrt(9570)-5/3;
M:=[52/4785*sqrt(9570),9/1595*sqrt(9570),-208/14355*sqrt(9570)+1/3];
m:=[-52/4785*sqrt(9570),-9/1595*sqrt(9570),208/14355*sqrt(9570)+1/3];
GfM:=RootedVector(root=M,<2,3,-5>);
GgM:=RootedVector(root=M,<104/1595*sqrt(9570),36/1595*sqrt(9570),0>);
GhM:=RootedVector(root=M,<4,0,3>);
Gfm:=RootedVector(root=m,<2,3,-5>);
Ggm:=RootedVector(root=m,<-104/1595*sqrt(9570),-36/1595*sqrt(9570),0>);
Ghm:=RootedVector(root=m,<4,0,3>);
p1M:=PlotVector([GfM,GgM,GhM],color=[black,red,green],width=.2);
p1m:=PlotVector([Gfm,Ggm,Ghm],color=[black,red,green],width=.2);
p2:=intersectplot(g,h,x=-2..2,y=-2..2,z=-3..3,color=black,thickness=3);
p3:=implicitplot3d([f=fM,f=fm],x=-4..4,y=-3..3,z=-4..4,style=surface,transparency=.3);
p4:=display(p1M,p1m,p2,p3,scaling=constrained,axes=frame,labels=[x,y,z],view=[-8..7,-3..4,-6..6],tickmarks=[8,7,9],orientation=[56,63,-1]);
print(p4);
end module:
end use:
|
|
Figure 4.9.10(b) Gradients of
|
|
|
|
|
|
•
|
The Lagrange multiplier method finds the point of tangency of the level surfaces of with the set of points common to the two constraints. The constraints intersect in a closed curve. Along this curve, the extrema of occur when such a plane is tangent to the curve. Such points of tangency are found by making a linear combination of the gradients of the two constraints, that is, by solving the equations in , along with the two constraint equations . This is the set of five equations
|
in the five unknowns . The solutions of these equations are then
and
|
|
Maple Solution - Interactive
|
|
Initialize
|
•
|
Tools≻Load Package:
Student Multivariate Calculus
|
|
Loading Student:-MultivariateCalculus
|
•
|
Context Panel: Assign Name
|
|
|
•
|
Context Panel: Assign Name
|
|
|
•
|
Context Panel: Assign name
|
|
|
•
|
Apply the LagrangeMultipliers command in the Student MultivariateCalculus package, captured in the
task template. See Table 4.9.10(a).
|
|
|
|
Tools≻Tasks≻Browse:
Calculus - Multivariate≻Optimization≻Lagrange Multiplier Method
|
Method of Lagrange Multipliers
|
Enter objective function
|
|
Enter constraints entered as functions
|
|
Enter coordinate variables, separated by commas:
|
|
|
|
|
|
|
Table 4.9.10(a) The Lagrange Multiplier Method task template
|
|
|
•
|
Converting the more cumbersome exact values in Table 4.9.10(a) to floating-point numbers results in the display to the right.
|
•
|
Obviously, one extrema is a maximum, and the other, a minimum.
|
|
|
|
|
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 .
|
•
|
Figure 4.9.10(c) shows the Optimization Assistant finding the maximum of 9.2 at approximately .
|
•
|
Figure 4.9.10(d) shows the Optimization Assistant finding the minimum of -12.54 at approximately .
|
|
|
Figure 4.9.10(c) Constrained maximum
|
|
|
|
|
Figure 4.9.10(d) Constrained minimum
|
|
|
|
|
|
Implement the Lagrange multiplier method via first principles
|
•
|
Context Panel: Assign Name
|
|
|
•
|
Write and press the Enter key.
|
•
|
Context Panel: Student Multivariate Calculus≻Differentiate≻Gradient
|
•
|
Context Panel: Conversions≻To List
|
•
|
Context Panel: Solve≻Solve (explicit)
|
|
|
|
|
|
|
Maple Solution - Coded
|
|
Initialize
|
•
|
Install the Student MultivariateCalculus package.
|
|
|
•
|
Define , the objective function.
|
|
|
•
|
Define , the first constraint function.
|
|
|
•
|
Define , the second constraint function.
|
|
|
Implement the Lagrange multiplier method
|
•
|
Invoke the LagrangeMultipliers command from the Student MultivariateCalculus package.
Use the print command and the tilde operator to list the solutions one beneath the other.
|
|
|
•
|
Add the "detailed" option to the LagrangeMultipliers command.
Use the print command and the tilde operator to list the solutions one beneath the other.
|
|
|
Implement the Lagrange multiplier method from first principles
|
|
|
•
|
Use the Equate command to equate each component of to zero.
|
•
|
Use the solve command to obtain the real solution of the equations in .
Use the print command and the tilde operator to list the solutions one beneath the other.
|
|
|
|
|
|
|
|
<< Previous Example Section 4.9
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
|