0% found this document useful (0 votes)
17 views2 pages

THVTP2B

Uploaded by

haphuong125405
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

THVTP2B

Uploaded by

haphuong125405
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

% Cau 1

clear all
clc
syms x y z a b c
f=(a*x+b*y+c*z)*asin(x*y*z)
diff(f,x)
diff(f,y)
diff(f,z)
diff(diff(f,x),x)
diff(diff(f,x),y)
diff(diff(f,x),z)
diff(diff(f,y),x)
diff(diff(f,y),y)
diff(diff(f,y),z)
diff(diff(f,z),x)
diff(diff(f,z),y)
diff(diff(f,z),z)
% Cau 2
%a
clear all
clc
syms x y
fa=x*sin(x+y)
int(int(fa,y,0,pi/3),x,0,pi/6)
%b
clear all
syms x y xc
f = x^2+2*y;
xc = 0:0.1:2;
y1 = xc;
y2 = xc.^3;
plot(xc,y1)
hold on
plot(xc,y2)
int(int(f,y,x^3,x),x,0,1)
%c
clear all
syms t
x = t;
y = sqrt(t);
int(exp(x)*diff(x,t),t,1,4)
%d
clear all
syms t
x = t;
y = 1+t^2;
F = [x/sqrt(x^2+y^2) y/sqrt(x^2+y^2)];
int(F(1)*diff(x,t)+F(2)*diff(y,t),t,-1,1)
% Cau 3
clear all
clc
syms x y
m = 20;
n = 10;
a = 0:1:20;
b = 0:1:10;
[X,Y] = meshgrid(a,b);
f = x*exp(-x*y);
S = 0;
for i=1:m
for j=1:n
S = S+subs(f,[x y],[(X(i)+X(i+1))/2 (Y(j)+Y(j+1))/2]);
end
end
S
% Cau 4
%a
syms x
syms y(x)
y=dsolve(diff(y,x)+y==1,y(0)==1);
X= -3:0.1:3;
Y=subs(y,x,X);
plot(X,Y)
%b
syms x
syms y(x)
y=dsolve((x^2+1)*diff(y,x)+3*x*(y-1)==0,y(0)==2);
X= -3:0.1:3;
Y=subs(y,x,X);
plot(X,Y)
%c
syms x
syms y(x)
y=dsolve(diff(y,x,2)-4*y==exp(x)*cos(x)+x^3,y(0)==1,subs(diff(y,x),x,0)==2);
X= -3:0.1:3;
Y=subs(y,x,X);
plot(X,Y)
% Cau 5
ezmesh('6*exp(-3*X.^2-Y.^2)+X./2+Y',[-10,10,-10,20])
% Cau 6
clear all
clc
syms x y
[X,Y] = meshgrid(-5:.5:5,-5:.5:5);
f = x*y - x^3/3;
fx = diff(f,x);
fy = diff(f,y);
for i=1:length(X)
for j=1:length(Y)
Px(i,j) = subs(fx, [x y], [X(i,j) Y(i,j)]);
Qy(i,j) = subs(fy, [x y], [X(i,j) Y(i,j)]);
end
end
quiver(X,Y,Px,Qy)
% Cau 7
syms x y
assume(x,'real')
assume(y,'real')
f=x^3-12*x*y+8*y^3;
fx=diff(f,x);
fy=diff(f,y);
[xc,yc]=solve(fx,fy,x,y);
[xc,yc];
fxx=diff(fx,x);
fyy=diff(fy,y);
fxy=diff(fx,y);
D=fxx*fyy-fxy^2;
for i=1:length(xc)
A=subs(D,[x y],[xc(i) yc(i)])
B=subs(fxx,[x y],[xc(i) yc(i)])
if A==0
disp("không có kết luận ")
end
if A>0&B>0
disp ('f đạt cực tiểu tại xc, yc')
C = [xc(i),yc(i)]
elseif A>0&B<0
disp ("f đạt cực đại tại xc,yc")
C = [xc(i),yc(i)]
else
disp("điểm yên ngựa")
C=[xc(i),yc(i)]
end
end

You might also like