MATH 251: Calculus 3, SET8

14: Partial Derivatives

14.7: Maximum and Minimum Values

These problems are done with the CAS. See Hand Solutions for details.

1. [968/4]

Using the contour map of level curves, we conclude the following, verified analytically via the Second Derivatives Test.
syms LocMax LocMin Saddle Unknown x y real
f(x,y) = 3*x - x^3 - 2*y^2 + y^4
f(x, y) = 
grad_f = gradient(f, [x y])'
grad_f(x, y) = 
hess = hessian(f, [x y]); H = hess(x,y)
H = 
LPMD(x,y) = [H(1,1), det(H)]
LPMD(x, y) = 
c = solve(grad_f == [0 0], [x y])
c = struct with fields:
x: [6×1 sym] y: [6×1 sym]
M = [c.x c.y], m = size(M,1)
M = 
m = 6
disp(' x y f LPMDs Type')
x y f LPMDs Type
for k = 1:m
xp = M(k,1); yp = M(k,2); P = [xp yp]; L = LPMD(xp,yp);
if L(1)>0 & L(2)>0
T = LocMin;
elseif L(1)<0 & L(2)>0
T = LocMax;
elseif L(2)<0
T = Saddle;
else
T = Unknown;
end
r = [P f(xp,yp) L T];
disp(r)
end
%
figure
fsurf(f(x,y), [-2 2 -2 2], 'MeshDensity', 20); hold on
plot3(c.x, c.y, f(c.x,c.y), 'ro', 'MarkerFaceColor', 'r', 'MarkerSize', 14)
xlabel('x'); ylabel('y'); zlabel('z')
title('SET8, 968/4'); alpha 0.4

2. [968/12]

syms LocMax LocMin Saddle Unknown x y real
f(x,y) = x^3 + y^3 - 3*x^2 - 3*y^2 - 9*x
f(x, y) = 
grad_f = gradient(f, [x y])'
grad_f(x, y) = 
hess = hessian(f, [x y]); H = hess(x,y)
H = 
LPMD(x,y) = [H(1,1), det(H)]
LPMD(x, y) = 
c = solve(grad_f == [0 0], [x y])
c = struct with fields:
x: [4×1 sym] y: [4×1 sym]
M = [c.x c.y], m = size(M,1)
M = 
m = 4
disp(' x y f LPMDs Type')
x y f LPMDs Type
for k = 1:m
xp = M(k,1); yp = M(k,2); P = [xp yp]; L = LPMD(xp,yp);
if L(1)>0 & L(2)>0
T = LocMin;
elseif L(1)<0 & L(2)>0
T = LocMax;
elseif L(2)<0
T = Saddle;
else
T = Unknown;
end
r = [P f(xp,yp) L T];
disp(r)
end
%
figure
fsurf(f(x,y), [-2 4 -1 3], 'MeshDensity', 20); hold on
plot3(c.x, c.y, f(c.x,c.y), 'ro', 'MarkerFaceColor', 'r', 'MarkerSize', 14)
xlabel('x'); ylabel('y'); zlabel('z')
title('SET8, 968/12'); alpha 0.4
view(50,26)

3. [968/16]

syms LocMax LocMin Saddle Unknown x y real
f(x,y) = x * y * exp(-(x^2 + y^2) / 2)
f(x, y) = 
grad_f = gradient(f, [x y])'
grad_f(x, y) = 
hess = hessian(f, [x y]); H = hess(x,y)
H = 
LPMD(x,y) = [H(1,1), det(H)]
LPMD(x, y) = 
c = solve(grad_f == [0 0], [x y])
c = struct with fields:
x: [5×1 sym] y: [5×1 sym]
M = [c.x c.y], m = size(M,1)
M = 
m = 5
disp(' x y f LPMDs Type')
x y f LPMDs Type
for k = 1:m
xp = M(k,1); yp = M(k,2); P = [xp yp]; L = LPMD(xp,yp);
if L(1)>0 & L(2)>0
T = LocMin;
elseif L(1)<0 & L(2)>0
T = LocMax;
elseif L(2)<0
T = Saddle;
else
T = Unknown;
end
r = [P f(xp,yp) L T];
disp(r)
end
%
figure
fsurf(f(x,y), [-2 3 -2 3], 'MeshDensity', 20); hold on
plot3(c.x, c.y, f(c.x,c.y), 'ro', 'MarkerFaceColor', 'r', 'MarkerSize', 14)
axis equal; axis([-2 3 -2 3 -1 1])
xlabel('x'); ylabel('y'); zlabel('z')
title('SET8, 968/16'); alpha 0.4

4. [968/24]

syms LocMax LocMin Saddle Unknown x y real
f(x,y) = (x - y) * exp(-x^2 - y^2)
f(x, y) = 
grad_f = gradient(f, [x y])'
grad_f(x, y) = 
hess = hessian(f, [x y]); H = hess(x,y)
H = 
LPMD(x,y) = [H(1,1), det(H)]
LPMD(x, y) = 
c = solve(grad_f == [0 0], [x y])
c = struct with fields:
x: [2×1 sym] y: [2×1 sym]
M = [c.x c.y], m = size(M,1)
M = 
m = 2
disp(' x y f LPMDs Type')
x y f LPMDs Type
for k = 1:m
xp = M(k,1); yp = M(k,2); P = [xp yp]; L = LPMD(xp,yp);
if L(1)>0 & L(2)>0
T = LocMin;
elseif L(1)<0 & L(2)>0
T = LocMax;
elseif L(2)<0
T = Saddle;
else
T = Unknown;
end
r = [P f(xp,yp) L T];
disp(r)
end
%
figure
fsurf(f(x,y), [-2 4 -1 3], 'MeshDensity', 20); hold on
plot3(c.x, c.y, f(c.x,c.y), 'ro', 'MarkerFaceColor', 'r', 'MarkerSize', 14)
axis equal; axis([-1 1 -1 1 -1 1])
xlabel('x'); ylabel('y'); zlabel('z')
title('SET8, 968/24'); alpha 0.4