Session7 2
Session7 2
Session7 2
% Symbolic variables
syms x y L real;
hold off;
title('Constrained Maxima/Minima’);
======================================================================================
%% MatLab code for Lagrange’s multiplier method for three variables:
if n > 1
F_max = max(F); % Find the maximum value of f
disp(['The maximum value of f under the given constraint g is: '
num2str(double(F_max))]);
F_min = min(F); % Find the minimum value of f
disp(['The minimum value of f under the given constraint g is: '
num2str(double(F_min))]);
else
disp(['The extremum value of f under the given constraint g is: '
num2str(double(F))]);
end
Practice Problems:
1. Find the extreme values of the func on f (x, y) = 3x + 4y on the circle x 2 + y 2 = 1.
x2 y2
2. Find the extreme values of the func on f (x, y) = x y on the ellipse + = 1.
8 2
3. Find the extreme values of the func on f (x, y, z) = x y 2 z 3 on the plane x + y + z = 24.
ti
ti
ti