You are on page 1of 4

ASSIGNMENT-4A:

Evaluate and visualize the tangent plane of the surface f(x,y)= (x2/16)+ (y2/9)+3 at
the point (5,-5).

MATLAB Code:
clear all
clc
syms x y
f=input('Enter the function: ')
x1 = 5;
y1 = -5;
ezsurf(f)
hold on
f1 = subs(subs(f,x,x1),y,y1)
fx = diff(f,x)
fy = diff(f,y)
fx1 = subs(subs(fx,x,x1),y,y1)
fy1 = subs(subs(fy,x,x1),y,y1)
disp('Equation of the Tangent Plane of a Surface at a Point
(5, -5):')
z=f1+fx1*(x-x1)+fy1*(y-y1)
ezsurf(z)

OUTPUT:

Enter the function: (x^2/16)+ (y^2/9)+3

f =x^2/16 + y^2/9 + 3

f1 =1057/144

fx =x/8

fy =(2*y)/9

fx1 =5/8

fy1 = - 10/9

Equation of the Tangent Plane of a Surface at a Point (5, -5):

z =(5*x)/8 - (10*y)/9 - 193/144


(5 x)/8 - (10 y)/9 - 193/144

-5

-10

5
5
0
0
-5 -5
y x
ASSIGNMENT-4B:

Write a Program to find extreme values of the function


f ( x, y) = x3 + 3xy 2 − 15x 2 − 15 y 2 + 72 x

m-file:

clc
clear all
syms x y real
f= input('Enter the function f(x,y):');
fx= diff(f,x);
fy=diff(f,y);
[ax ay] = solve(fx,fy)
fxx= diff(fx,x);
fxy=diff(fx,y);
fyy =diff(fy,y);
D=fxx*fyy-fxy^2;
a=min(double(ax));
b=max(double(ax));
c=min(double(ay));
d=max(double(ay));
ezsurf(f,[a-0.5,b+0.5,c-0.5, d+0.5]);
colormap winter
shading interp
for i = 1:1:size(ax)
T1=subs(D,x,ax(i));
T1=subs(T1,y,ay(i));
T2=subs(fxx,x,ax(i));
T2=subs(T2,y,ay(i));
T3=subs(f,x,ax(i));
T3=subs(T3,y,ay(i));
if (double(T1) == 0)
sprintf('The point (%d,%d) needs further investigation',
double(ax(i)),double(ay(i)))
st='k+';
elseif (double(T1) < 0)
sprintf('The point (%d,%d) is a saddle point', double(ax(i)),
double(ay(i)))
st = 'y.';
elseif (double(T2) < 0)
sprintf('Maximum = %d at
(%d,%d)',double(T3),double(ax(i)),double(ay(i)))
st = 'r+';
else
sprintf('Minimum = %d at
(%d,%d)',double(T3),double(ax(i)),double(ay(i)))
st = 'b*';
end
hold on
plot3(double(ax(i)),double(ay(i)),double(T3),st,'markersize',2
0);
end

OUTPUT:

Enter the function f(x,y):x^3+3*x*y^2-15*x^2-15*y^2+72*x

ax = 4 6 5 5

ay = 0 0 1 -1

ans =Maximum = 112 at (4,0)

ans = Minimum = 108 at (6,0)

ans =The point (5,1) is a saddle point

ans =The point (5,-1) is a saddle point

72 x + 3 x y 2 - 15 x 2 + x 3 - 15 y 2

115

110

105

1
6.5
6
0 5.5
5
-1 4.5
4
y 3.5
x

You might also like