Chapter 4: Partial Differentiation
Section 4.9: Constrained Optimization
|
Example 4.9.8
|
|
a)
|
Find the point(s) on the the curve closest to, and farthest from, the point .
|
b)
|
Obtain a graph of the level curves of the objective function , and on this graph superimpose the graph of the constraint curve.
|
|
|
|
|
Solution
|
|
|
Mathematical Solution
|
|
•
|
The distance from the point to the graph of is given by , where along the constraint curve.
|
•
|
The objective function will be taken as , the square of the distance from the point to the constraint curve defined by .
|
•
|
Figure 4.9.8(a) shows level curves of in black, and the graph of , in red.
|
•
|
The constraint curve is tangent to a level curve at the four points listed in Table 4.9.8(a), a table that also gives approximate values of and at the critical points.
|
Critical Point
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 4.9.8(a) Extrema given approximately
|
|
|
|
>
|
use plots in
module()
local p1,p2,p3;
p1:=contourplot((x-1)^2+(y-2)^2,x=-3..3,y=-2..4,color=black,contours=[.5,1.0442,2,4,7,10,11.8137,13.715,15.4267]);
p2:=implicitplot(x^2+2*x*y+3*y^2-5 = 0,x=-3..3,y=-2..2,color=red);
p3:=display(p1,p2,scaling=constrained);
print(p3);
end module:
end use:
|
|
Figure 4.9.8(a) Level curves of and
|
|
|
|
|
|
The Lagrange multiplier method finds extrema by determining points of tangency between the constraint curve and the level curves of the objective function by finding points where the gradients and are collinear. This is done by solving the equations and for . The resulting equations are
An exact solution of these equations is not possible, so numeric algorithms give the four solutions summarized in Table 4.9.8(a).
|
|
Maple Solution - Interactive
|
|
Initialize
|
•
|
Tools≻Load Package: Student Multivariate Calculus
|
|
Loading Student:-MultivariateCalculus
|
•
|
Context Panel: Assign Name
|
|
|
•
|
Context Panel: Assign Name
|
|
|
|
|
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.8(b) shows the Optimization Assistant finding the absolute minimum.
|
•
|
Figure 4.9.8(c) shows the Optimization Assistant finding the absolute maximum.
|
|
|
Figure 4.9.8(b) Constrained minimum
|
|
|
|
|
Figure 4.9.8(c) Constrained maximum
|
|
|
|
|
|
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: Assign to a Name≻
|
|
|
•
|
Type and press the Enter key for a display of the Lagrange multiplier equations.
|
•
|
Context Panel: Solve≻Numerically Solve (for the first solution)
|
•
|
Context Panel: Solve≻Numerically Solve from point (solutions 2 - 4)
(Select starting values gleaned from Figure 4.9.8(a).)
|
|
|
|
|
|
|
|
|
|
Maple Solution - Coded
|
|
Initialize
|
•
|
Install the Student MultivariateCalculus package.
|
|
|
•
|
Define , the objective function.
|
|
|
•
|
Define , the constraint function.
|
|
|
Implement the Lagrange multiplier method
|
•
|
Invoke the LagrangeMultipliers command from the Student MultivariateCalculus package.
The exact forms of the solutions are exceedingly large and cumbersome. Immediately float these expressions with the evalf command, which, unfortunately, generates numbers with a small imaginary part. Remove these small imaginary parts by applying simplify to the result of using the fnormal command. Use the print command and the tilde operator to display the solutions one above the other.
|
|
|
•
|
Add the "detailed" option to the LagrangeMultipliers command.
The exact forms of the solutions are exceedingly large and cumbersome. Immediately float these expressions with the evalf command, which, unfortunately, generates numbers with a small imaginary part. Remove these small imaginary parts by applying simplify to the result of using the fnormal command. Use the print command and the tilde operator to display the solutions one above the other.
|
|
|
Implement the Lagrange multiplier method from first principles
|
|
|
•
|
Use the Gradient command to obtain .
|
•
|
Use the Equate command to equate each component of to zero.
|
•
|
Use the fsolve command to obtain a numeric solution of the equations in .
Use the avoid option to obtain four different solutions.
|
|
|
|
|
|
|
|
Obtain and at each critical point
|
=
|
=
|
=
|
=
|
=
|
=
|
=
|
=
|
=
|
=
|
=
|
=
|
|
|
|
|
|
<< 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
|