Digital Assessment 1
Digital Assessment 1
ASSESSMENT-4
NAME: KAVIN.M
REG NO: 24BEE0063
STAFF NAME:BALA ANKI
REDDY
ASSESSMENT ON
MATLAB
Question 1.
Syms x y z
Xa = 2;
Xb = 4;
Ya = 2;
Yb = sqrt((16 – x^2) / 8);
Za = 0;
Zb = 16 – 2 * y^2 – x^2;
Volume = int(int(int(1 + 0*z, z, za, zb), y, ya, yb),
x, xa, xb);
Disp(vpa(volume));
[X, Y] = meshgrid(linspace(xa, xb, 100),
linspace(ya, ya, 100));
Z_lower = zeros(size(X));
Z_upper = 16 – 2 * Y.^2 – X.^2;
Figure;
Surf(X, Y, Z_lower, ‘FaceColor’, ‘b’, ‘FaceAlpha’,
0.5); hold on;
Surf(X, Y, Z_upper, ‘FaceColor’, ‘r’, ‘FaceAlpha’,
0.5);
Xlabel(‘X’);
Ylabel(‘Y’);
Zlabel(‘Z’);
Title(‘Volume Boundaries between Z_{lower}
and Z_{upper}’);
Grid on;
OUTPUT:
Volume:3.627148831466533498677799689211
GRAPH:
QUESTION-2:
CODE ON MATLAB:
Syms x y z
Xa = 0;
Xb = 2;
Ya = 0;
Yb = 2 – x;
Za = 4 – 2*x – 2*y;
Zb = (2 – x – y) / 2;
I = int(int(int(1 + 0*z, z, za, zb), y, ya, yb), x, xa, xb);
Disp(‘The result of the integral is:’);
Disp(vpa(I));
[X, Y] = meshgrid(linspace(xa, xb, 100), linspace(ya,
2, 100));
Z_lower = 4 – 2*X – 2*Y;
Z_upper = (2 – X – Y) / 2;
Figure;
Surf(X, Y, Z_lower, ‘FaceColor’, ‘b’, ‘FaceAlpha’,
0.5);
hold on;
Surf(X, Y, Z_upper, ‘FaceColor’, ‘r’, ‘FaceAlpha’,
0.5);
Grid on;
Hold off
OUTPUT:
The result of the integral is:2.0
GRAPH:
Question 3.
Code on Matlab:
syms x y
f=exp(x)*cos(1+y);
as=taylor(f,[x,y],[1,pi/4],'order',6)
subplot(1,2,1);
ezsurf(f);
subplot(1,2,2);
ezsurf(as)
OUTPUT:
as=
exp(1)cos(pi/4 + 1) + exp(1)*cos(pi/4 + 1)(x - 1) -
(exp(1)cos(pi/4 + 1)(y - pi/4)^2)/2 + (exp(1)cos(pi/4
+ 1)(y - pi/4)^4)/24 + (exp(1)sin(pi/4 + 1)(y -
pi/4)^3)/6 - (exp(1)sin(pi/4 + 1)(y - pi/4)^5)/120 +
(exp(1)cos(pi/4 + 1)(x - 1)^2)/2 + (exp(1)cos(pi/4 +
1)(x - 1)^3)/6 + (exp(1)cos(pi/4 + 1)(x - 1)^4)/24 +
(exp(1)cos(pi/4 + 1)(x - 1)^5)/120 - exp(1)sin(pi/4 +
1)(y - pi/4) - (exp(1)sin(pi/4 + 1)(y - pi/4)(x - 1)^2)/2 -
(exp(1)*sin(pi/4 + 1)(y - pi/4)(x - 1)^3)/6 +
(exp(1)*sin(pi/4 + 1)(y - pi/4)^3*(x - 1))/6 -
(exp(1)sin(pi/4 + 1)(y - pi/4)(x - 1)^4)/24 -
(exp(1)*cos(pi/4 + 1)(y - pi/4)^2*(x - 1)^2)/4 -
(exp(1)cos(pi/4 + 1)(y - pi/4)^2*(x - 1)^3)/12 +
(exp(1)sin(pi/4 + 1)(y - pi/4)^3*(x - 1)^2)/12 -
exp(1)sin(pi/4 + 1)(y - pi/4)(x - 1) - (exp(1)*cos(pi/4
+ 1)(y - pi/4)^2*(x - 1))/2 + (exp(1)cos(pi/4 + 1)(y -
pi/4)^4*(x - 1))/24
GRAPH:
Question 4:
Find tha maximum and minimum of
f(x,y)=x^3+3xy^y-15x^2-15y^2+72x
CODE ON MATLAB:
clc
clear all
syms x y
f = x^3-(3*x*y^2)-(15*x^2)-(15*y^2)+72*x
fx = diff(f,x);
fy = diff(f,y);
[xc,yc] = solve(fx,fy,x,y);
disp('Critical Points')
[xc,yc]
r = diff(fx,x); % r=fxx
s = diff(fx,y); % s=fxy
t = diff(fy,y); % t=fyy
D = r*t-s^2;
a=size(xc);
for i=1:1:a(1)
disp('critical point:')
[xc(i) yc(i)]
p=subs(D,{x,y},{xc(i),yc(i)});
q=subs(r,{x,y},{xc(i),yc(i)});
if p>0
if q>0
disp('minimum point')
disp('minimum value of f:')
subs(f,{x,y},{xc(i),yc(i)})
elseif q<0
disp('maximum point')
disp('maximum value of f:')
subs(f,{x,y},{xc(i),yc(i)})
else
disp('further investigation is required')
end
elseif p<0
disp('saddle point')
else
disp('further investigation is required')
end
end
ezsurf(f,[-1.5,1.5,-1.5,1.5]);
OUTPUT:
clc
clear all
syms x y
f = sin(x)*sin(y)*sin(x+y)
fx = diff(f,x);
fy = diff(f,y);
[xc,yc] = solve(fx,fy,x,y);
disp('Critical Points')
[xc,yc]
r = diff(fx,x); % r=fxx
s = diff(fx,y); % s=fxy
t = diff(fy,y); % t=fyy
D = r*t-s^2;
a=size(xc);
for i=1:1:a(1)
disp('critical point:')
[xc(i) yc(i)]
p=subs(D,{x,y},{xc(i),yc(i)});
q=subs(r,{x,y},{xc(i),yc(i)});
if p>0
if q>0
disp('minimum point')
disp('minimum value of f:')
subs(f,{x,y},{xc(i),yc(i)})
elseif q<0
disp('maximum point')
disp('maximum value of f:')
subs(f,{x,y},{xc(i),yc(i)})
else
disp('further investigation is required')
end
elseif p<0
disp('saddle point')
else
disp('further investigation is required')
end
end
ezsurf(f,[-1.5,1.5,-1.5,1.5]);
OUTPUT:
F=sin(x + y)*sin(x)*sin(y)