Báo cáo bài tập lớn môn Giải tích 1

đề tài 7: Nhập hàm số y=f(x) liên tục trên (1,+) (không cần kiểm tra tính liên tục). Viết chương trình khảo sát sự hội tụ cảu tích phân suy rộng loại 1:∫_1^∞▒f(x)dx. Nếu tích phân hội tụ hãy tính diện tích miền D giưới hạn bởi y=f(x), y=0,x=a. Vẽ miền D. function cau7 syms x f=input('nhap ham f= ' ); g=0; t=vpa(int(f,x,1,inf)) if t==t-1 fprintf('tich phan phan ki\n\n'); else fprintf('tich phan hoi tu\n'); a=input('nhap bien tinh dien tich: a= '); s = int(abs(f),1,a); fprintf('dien tich mien D la: %f\n',s); x1 = linspace(1,a); x2 = linspace(a,1); y1 = subs(f,x1); y2 = subs(0,x2); fill([x1,x2],[y1,y2],'r'); title(sprintf('Area D is: %f',s)); hold off; end

docx17 trang | Chia sẻ: thanhle95 | Lượt xem: 286 | Lượt tải: 0download
Bạn đang xem nội dung tài liệu Báo cáo bài tập lớn môn Giải tích 1, để tải tài liệu về máy bạn click vào nút DOWNLOAD ở trên
CHƯƠNG TRÌNH CODE VÀ VÍ DỤ đề tài 1: cho miền D trogn mặt phẳng giới hạn bởi f=f(x),y=g(x),x=a,x=b (f(x),g(x),a,b, nhập từ bàn phím). Viết chương trình tính diện tích miền phẳng D và vẽ miền D minh họa. function detai1 syms x; f = input('f(x)= '); g = input('g(x)= '); disp('[a b]: '); a = input('a = '); b = input('b = '); s = int(abs(f-g),a,b); fprintf('dien tich mien D la: %f\n',s); x1 = linspace(a,b); x2 = linspace(b,a); y1 = subs(f,x,x1); y2 = subs(g,x,x2); fill([x1,x2],[y1,y2],'r'); title(sprintf('Area D is: %f',s)); hold off; end vd1: >> detai1 f(x)= 2*x^3+6*x+7 g(x)= 4*x^2+5*x+6 [a b]: a = -5 b = 6 dien tich mien D la: 871.166667 >> vd2: >> detai1 f(x)= x+25 g(x)= 3*x^2+6*x+7 [a b]: a = 1 b = 10 dien tich mien D la: 1092.469002 >> đề tài 3: Cho hàm f(x) có dạng phân thức. Viết chương trình tìm cực trị, tiệm cận và vẽ đồ thị của y=f(x) với điểm cực trị và các đường tiệm cận trên đồ thị. function detai3 syms x; f = input('f(x) = '); fprintf('\n'); % Vertical asymptote [numerator,denominator] = numden(f); xV = vpa(solve(denominator)); v_As = []; for i=xV' if isreal(i) l = limit(f^2,x,i); if l==l-1 fprintf('tiem can dung x = %f \n',i); v_As = [v_As,i]; end; end; end; fprintf('\n'); % Horizontal asymptote h_As=[limit(f,x,inf), limit(f,x,-inf)]; if h_As(1)~=h_As(1)-1 fprintf('tiem can ngang y = %f\n',h_As(1)); end if h_As(2)~=h_As(2)-1 if h_As(1)~=h_As(2) fprintf('tiem can ngang y = %f\n',h_As(2)); end end fprintf('\n'); % Diagonal asymptote aD1 = limit(f/x,x,inf); bD1 = limit(f-aD1*x,x,inf); aD2 = limit(f/x,x,-inf); bD2 = limit(f-aD2*x,x,-inf); D1(x) = aD1*x + bD1; D2(x) = aD2*x + bD2; if aD1~=0 || aD2 ~= 0 if aD1==aD2 && bD1 == bD2 fprintf('tiem can xien y = %fx + %f\n',aD1,bD1); else fprintf('tiem can xien y = %fx + %f\n',aD1,bD1); fprintf('tiem can xien y = %0.4fx + %0.4f\n',aD2,bD2); end end fprintf('\n'); %max - min f1=diff(f); f2=diff(f,2); ct=vpa(solve(f1)); hold on; for i=ct' if isreal(ct) if subs(f2,i)>0 fprintf('ham so dat cuc tieu tai x = %f , Fmin = %f\n',i,subs(f,i)); plot(i,subs(f,i),'ko'); text(double(i),double(subs(f,i)),' <----local min'); elseif subs(f2,i)<0 fprintf('ham so dat cuc dai tai x = %f , Fmax = %f\n',i,subs(f,i)); plot(i,subs(f,i),'ko'); text(double(i),double(subs(f,i)),' <----local max'); else fprintf('ham so co diem uon tai x = %f\n',i); end end end % Draw ezplot(f); for i=v_As yDraw = [-100,100]; xDraw = [i i]; plot(xDraw,yDraw,'r-'); end; for i=h_As xDraw = [-100,100]; yDraw = [i i]; plot(xDraw,yDraw,'r-'); end; xDraw = [-100,100]; yDraw = D1(xDraw); plot(xDraw,yDraw,'r-'); yDraw = D2(xDraw); plot(xDraw,yDraw,'r-'); xlabel('x'); ylabel('y'); grid on; hold off; end vd1: >> detai3 f(x) = (4*x^2+5*x+6)/(2*x+3) tiem can dung x = -1.500000 tiem can xien y = 2.000000x + -0.500000 ham so dat cuc dai tai x = -2.869306 , Fmax = -8.977226 ham so dat cuc tieu tai x = -0.130694 , Fmin = 1.977226 >> vd2: >> detai3 f(x) = (x+1)/sqrt(x^2+1) tiem can ngang y = 1.000000 tiem can ngang y = -1.000000 ham so dat cuc dai tai x = 1.000000 , Fmax = 1.414214 >> đề tài 5: Cho D giới hạn bởi y=f(x), y=g(x),x=a,x=b. Viết chương trình tính thể tích vật thể tạo ra khi cho mình D quay quanh truc Ox function detai5 syms x; f = input('f(x)= '); g = input('g(x)= '); disp('[a b]: '); a = input('a = '); b = input('b = '); % Tinh tich phan bang cong thuc Simpson mo rong m = 300; h = (b-a)/m; I = 0; for i=0:m x = a+h*i; f = subs(f,x); g = subs(g,x); if f*g<=0 y = max(f^2,g^2); else y = abs(f^2-g^2); end if (i==0 || i==m) I = I + y; elseif (mod(i,2)==0) I = I + 2*y; else I = I + 4*y; end end I = pi*I*h/3; fprintf('the tich khoi tron xoay: S = %f\n',I); end vd1: >> detai5 f(x)= x^2+6*x+7 g(x)= 7*x^3+2*x^2+5 [a b]: a = -1 b = 1 the tich khoi tron xoay: S = 25.132741 >> vd2: >> detai5 f(x)= 5*x+55 g(x)= 4*x^2+5*x+3 [a b]: a = -6 b = 10 the tich khoi tron xoay: S = 656668.262824 >> đề tài 7: Nhập hàm số y=f(x) liên tục trên (1,+¥) (không cần kiểm tra tính liên tục). Viết chương trình khảo sát sự hội tụ cảu tích phân suy rộng loại 1:1∞fxdx. Nếu tích phân hội tụ hãy tính diện tích miền D giưới hạn bởi y=f(x), y=0,x=a. Vẽ miền D. function cau7 syms x f=input('nhap ham f= ' ); g=0; t=vpa(int(f,x,1,inf)) if t==t-1 fprintf('tich phan phan ki\n\n'); else fprintf('tich phan hoi tu\n'); a=input('nhap bien tinh dien tich: a= '); s = int(abs(f),1,a); fprintf('dien tich mien D la: %f\n',s); x1 = linspace(1,a); x2 = linspace(a,1); y1 = subs(f,x1); y2 = subs(0,x2); fill([x1,x2],[y1,y2],'r'); title(sprintf('Area D is: %f',s)); hold off; end vd1: >> cau7 nhap ham f= (4*x^2+5*x)/(6*x^3+9*x^2+6*x+1) t = Inf tich phan phan ki >> vd2: >> cau7 nhap ham f= (2+x)/(4*x^3+6*x+7) t = 0.2796941889421910210732829962181 tich phan hoi tu nhap bien tinh dien tich: a= 9 dien tich mien D la: 0.249047 >> đề tài 9: Cho hàm y=y(x) xác định bởi phương trình tham số y=y(t), x=x(t) (y=y(t),x=x(t) là các hàm phân thức nhập từ ban phím). Tìm cực trị bằng cách tính đạp hàm cấp 1 và đạo hàm cấp 2. Vẽ hình minh họa function detai9 syms t y = input('nhap ham y theo t: y(t)= '); x = input('nhap ham x theo t: x(t)= '); fprintf('\n\n'); f1 = diff(y)/diff(x); f2 = diff(f1)/diff(x); ct = vpa(solve(f1)); d=0; tmin=[]; tmax=[]; %tim cuc tri for i=ct' if isreal(i) if subs(f2,i)>0 d=1; fprintf('ham so dat cuc tieu tai x= %f, Fct= %f\n',subs(x,i),subs(y,i)); tmin=[i tmin]; elseif subs(f2,i)<0 d=1; fprintf('ham so dat cuc dai tai x= %f, Fcd= %f\n',subs(x,i),subs(y,i)); tmax=[i tmax]; else fprintf('ham so co diem uon tai x= %f',subs(x,i)); end end end if d==0 disp('ham so khong co cuc tri'); end %ve do thi %y(x) subplot(2,1,1) grid on fplot(x,y); hold on %ve diem cuc tri tren y(x) for i=tmin plot(subs(x,i),subs(y,i),'ko'); text(double(subs(x,i)),double(subs(y,i)),' <----local min'); end for i=tmax plot(subs(x,i),subs(y,i),'ko'); text(double(subs(x,i)),double(subs(y,i)),' <----local max'); end title('y=f(x)'); xlabel('x'); ylabel('y(x)'); %x(t) va y(t) subplot(2,1,2) grid on fplot(x,'r-'); hold on; fplot(y,'b--'); xlabel('t'); ylabel('x(t) va y(t)'); for i=tmin plot(i,subs(x,i),'ko'); text(double(i),double(subs(x,i)),' <----local x min'); plot(i,subs(y,i),'ko'); text(double(i),double(subs(y,i)),' <----local y min'); end for i=tmax plot(i,subs(x,i),'ko'); text(double(i),double(subs(x,i)),' <----local x max'); plot(i,subs(y,i),'ko'); text(double(i),double(subs(y,i)),' <----local y max'); end title(sprintf('x = %s, y = %s',char(x),char(y))); legend(char(x),char(y)) end vd1: >> detai9 nhap ham y theo t: y(t)= 5*t^3+6*t+7 nhap ham x theo t: x(t)= 400-100*t ham so khong co cuc tri >> vd2: >> detai9 nhap ham y theo t: y(t)= 5*t^2+6*t+7 nhap ham x theo t: x(t)= 100-73*t ham so dat cuc tieu tai x= 143.800000, Fct= 5.200000 >> PHẦN COMMAND WINDOW I-Tính Giới Hạn Câu 1 limn→∞n+-1nn--1n >> syms n >> limit((n+(-1)^n)/(n-(-1)^n), inf) ans = 1 Câu 3 limn→∞(n2+4n-n+1) >> syms n >> limit(sqrt(n^2 + 4*n) - n + 1, inf) ans = 3 Câu 5 limx→∞(x+3x-2)2x+1 >> syms x >> limit(((x- 3)/(x+2))^(2*x+ 1), inf) ans = exp(-10) Câu 7 limx →13x-15x-1 >> syms x >> limit((x^(1/3)-1)/(x^(1/5)-1),inf) ans = Inf Câu 9 limn→∞2n3-4n+13n-22n-1+5n7 >> syms n >> limit((2*n^3- 4^(n+1))/(3^n- 2^(2*n-1)+ 5*n^7), inf) ans = 8 II- Tính Đạo Hàm: Câu 11 fx=x+sinxx,f'(π4) >> syms x >> subs(diff((x+sin(x))^x, 1),pi/4) ans = log(pi/4 + 2^(1/2)/2)*(pi/4 + 2^(1/2)/2)^(pi/4) + (pi*(2^(1/2)/2 + 1)*(pi/4 + 2^(1/2)/2)^(pi/4 - 1))/4 Câu 13 y=fx= x=t3+3t y=lnt+t2-3,y'(t=2) >> syms t >> xt=subs(diff(t^3+ 3*t, 1), 2) xt = 15 >> yt=subs(diff(log(t+ sqrt(t^2- 3)), 1), 2) yt = 1 >> yx=yt/xt yx = 1/15 fx=ln⁡(tanπ4+x2,f''(0) Câu 15 >> syms x >> subs(diff(log(tan(pi/4+ x/2)), 2), 0) ans = 0 Câu 17 fx= exx2, f''(1) >> syms x >> subs(diff(exp(x)/x^2,2), 1) ans = 3*exp(1) Câu 19 fx=e2x.sin3x, f3(0) >> syms x >> subs(diff(exp(2*x)*sin(3*x), 3), 0) ans = 9 III. Tính tích phân Câu 21 12xlnxdx >> syms x >> int(x*log(x), 1, 2) ans = log(4) - ¾ Câu 23 01x.arctanxdx >> syms x >> int(x*atan(x), 0, 1) ans = pi/4 - ½ Câu 25 0∞e-x2dx >> syms x >> int(exp(-x^2), 0, inf) ans = pi^(1/2)/2 Câu 27 0∞dxx3+1 >> syms x >> int(1/(x^3+ 1),0, inf) ans = (2*pi*3^(1/2))/9 IV- Diện Tích Miền Phẳng: Câu 29 D:y=x2, y=x+2 >> syms x y >> int(abs(x^2-x-2), -1, 2) ans = 9/2 Câu 31 D:y=3x, y=4-x >> syms x >> solve('3/x=4-x ') ans = 1 3 >> int(abs(4-x-3/x), 1, 3) ans = 4 - log(27) Câu 33 D:y=lnx+2,y=2lnx, x=1e >> syms x >> x0=solve('log(x+2)=2*log(x) ') x0 = 2 >> int(abs(log(x+2)- 2*log(x)), 1/exp(1), x0) ans = (829873891399877939*log(2))/9007199254740992 + (6627126856707895*log(6627126856707895))/9007199254740992 - (42655923875671863*log(42655923875671863))/18014398509481984 + 29401670162256073/18014398509481984 Câu 35 D:y=arcsinx,x=0,y=π2 >> syms x >> solve('asin(x)=pi/2 ') ans = 1 >> int(abs(asin(x)-pi/2), 0, 1) ans = 1 V- Tính Diện Tích Mặt Cong Câu 37 Sx:y=1+x2, 0≤x≤1 >>syms x >> int(sqrt(1+x^2),0,1) ans = log(2^(1/2) + 1)/2 + 2^(1/2)/2 Câu 39 P:y=5x+x2 bị chắn bởi y=4. Tính Sx >> syms x >> solve(‘5*x+x^2=4’) ans = 41^(1/2)/2 - 5/2 - 41^(1/2)/2 - 5/2 >> a=-41^(1/2)-5/2; >>b= 41^(1/2)/2 - 5/2; >> Sx=int(abs(5*x+x^2),a,b) ans = 18520397305221071401051528028275585785857/1020847100762815390390123822295304634368 VI-Tính Thể Tích Câu 41 Vx:y=1-x2,y=0 >> syms x >> solve(sqrt(1-x^2)==0) ans = -1 1 >> f=sqrt(1-x^2) f = (1 - x^2)^(1/2) >> Vx=pi*int(f^2, -1, 1) Vx = (4*pi)/3 Câu 43 Vy:y=x2+1,y=5,x≥0 >> syms x >> solve(x^2+ 1==5) ans = -2 2 >> f=x^2+1-5 f = x^2 - 4 >> Vy=2*pi*int(abs(x*f), 0, 2) Vy = 8*pi Câu 45 Vy:y=2x-x2,y=3, 0≤x≤3 >> syms x >> Vy=2*pi*int(abs(x*(2*x- x^2- 3)), 0, 3) Vy = (63*pi)/2 VII- Tính Độ Dài Đường Cong: bài 47 y=x3 , 0≤x≤4 >> syms x >> y=sqrt(x^3); >> A=diff(y) A =(3*x^2)/(2*(x^3)^(1/2)) >> B=sqrt(1+A^2) B = ((9*x)/4 + 1)^(1/2) >> int(B,0,4) ans = (80*10^(1/2))/27 - 8/27 bài 49 y=x2 , y≤1 >> syms x >> y=log(cos(x)) y = log(cos(x)) >> A=diff(y) A = -sin(x)/cos(x) >> B=sqrt(1+A^2) B =(sin(x)^2/cos(x)^2 + 1)^(1/2) >> int(B,0,pi/4) ans = log(2^(1/2) + 1) VIII- Giải Phương Trình Vi Phân: Câu 51 xy'-y=x2+y2 >> syms y(x) >> y=dsolve(x*diff(y)-y==sqrt(x^2+ y^2)) y = (C19^2*x^2 - 4)/(4*C19) x*i -x*i Câu 53 y''-3y'+2y=3e2x, y0=y'0=1 >> syms y(x) >> dsolve(diff(y,2)-3*diff(y)+2*y==3*exp(2*x),y(0)==1,subs(diff(y),0)==1) ans = 4*exp(x) - 3*exp(2*x) + 3*x*exp(2*x) Câu 55 y''+3xy=2x3, y1=0 >> syms y(x) >> dsolve(diff(y)+3*y/x==2/x^3, y(1)==0) ans 2/x^2 - 2/x^3 IX: Tính Đạo Hàm Trái, Phải tại x=x0 và vẽ đường cong cùng tiếp tuyết tại (x0,f(x0)) Câu 57 >>syms x >>f=(exp(x)-1)/x; >>g=x/2; >>f1=diff(f); >>g1=diff(g) g1 = 1/2 >>limit(f1,x,0,'right') ans = 1/2 >>x1=0:0.01:3; >>y1=(exp(x1)-1)./x1; >>plot(x1,y1) >> hold on >>x2=-3:0.01:0; >> y2=x2./2; >>plot(x2,y2) >> x3=0:0.01:3; >>y3=(x3-2)/2+subs(f,x,2); >> plot(x3,y3) CẢM ƠN CÔ Đà XEM VÀ ĐÁNH GIÁ BÀI BÁO CÁO CỦA NHÓM CHÚNG EM HẾT **šõœ›**
Tài liệu liên quan