2 семестр МПиТК / 2-й семестр / МП-1А / Ильин. БДЗ
.docxИльин Р.
МП-10
Упражнение 1
syms x;
f=((x+2)/sqrt(8-2*x-x^2));
int(f,x,-1,0),
ans = 0.5114
function Sum(f,n,a,b,l)
dx=(b-a)/n;
smin=0;
SMAX=0;
SL=0;
SR=0;
S=0;
for i=0:1:n-1;
x=a+i*dx:0.0001:a+(i+1)*dx;
smin=smin+min(subs(f,x))*dx;
SMAX=SMAX+max(subs(f,x))*dx;
SL=SL+subs(f,a+i*dx)*dx;
SR=SR+subs(f,a+(i+1)*dx)*dx;
xc=a+i*dx+dx/l;
S=S+subs(f,xc)*dx;
end
smin,
SMAX,
SL,
SR,
S,
end
Sum(f,100,-1,0,2),
smin = 0.5095
SMAX = 0.5133
SL = 0.5095
SR = 0.5133
S = 0.5114
Упражнение 2
>> x=-2.25:0.1:0.25;
>> y1=2.*x.^2.*exp(x);
>> y2= (-1).*x.^3.*exp(x);
>> plot(x,y1,x,y2);
>> hold on;
>> grid on;
syms x
f1=2*x^2*exp(x);
f2=(-1)*2*x^3*exp(x);
S=int(f2,x,-2,0)-int(f1,x,-2,0),
f1=sqrt(1+(diff((2*x^2*exp(x)),x,1))^2);
f2=sqrt(1+(diff(((-1)*2*x^3*exp(x)),x,1))^2);
L=int(f2,x,-2,0)+int(f1,x,-2,0),
f1=(2*x^2*exp(x))^2;
f2=((-1)*2*x^3*exp(x))^2;
Vx=pi*(int(f2,x,-2,0)-int(f1,x,-2,0)),
f1=x*(2*x^2*exp(x));
f2=x*((-1)*2*x^3*exp(x));
Vy=2*pi*(int(f1,x,-2,0)-int(f2,x,-2,0)),
S = 0.4212
L = 5.3891
Vx = 4.3250
Vy = 5.1071
Упражнение 3
syms x a b;
f=1/(x^2+5*x+7);
limit(int(f,x,a,1),a,-inf)+limit(int(f,x,1,b),b,+inf),
ans = 3.6276
limit(int(f,x,a,100),a,-inf),
ans = 3.6178
limit(int(f,x,a,1000),a,-inf),
ans = 3.6266
Упражнение 4
syms x a;
f=x^4/(1-x^2);
limit(int(f,x,a,1),a,0,'right'),
ans = Inf
int(f,x,0.01,1),
ans = Inf
int(f,x,0.001,1),
ans = Inf
Упражнение 5
syms x b;
f=log(sin(x));
quad('log(sin(x))',0,pi/2),
ans = -1.0888
Упражнение 6
function f=Ser(an1, an2, n0)
grid on
hold on
s=0;
for i=1:1:n0
s=s+subs(an1,i);
plot(i,s,'*r', 'LineWidth',1);
end
s=0;
for i=1:1:n0
s=s+subs(an2,i);
plot(i,s,'*g', 'LineWidth',1);
end
end
an1=@(n)(1/sqrt(n))*sin(1/n);
an2=@(n)1/sqrt(n);
Ser(an1,an2,100);
Упражнение 7
function s = SumSer(an, eps)
q = 1;
Rn = 1;
s = 0;
n = 1;
while(q >= 1)
q = an( n + 1 ) / an( n );
s = s + an( n );
n = n + 1;
end
while( Rn > eps)
q = an(n + 1) / an(n);
s = s + an( n );
n = n + 1;
Rn = an( n + 1 ) / ( 1 - q );
end
end
an=@(n)( factorial (n)/ factorial (2*n))*tan(1/5^( factorial (n)));
Sumer(an, 0.001),
ans = 0.1047
Упражнение 8
function s = SumSer(an, eps)
q = 1;
Rn = 1;
s = 0;
n = 1;
while(q >= 1)
q = an( n + 1 ) / an( n );
s = s + an( n );
n = n + 1;
end
while( Rn > eps)
q = an(n + 1) / an(n);
s = s + an( n );
n = n + 1;
Rn = an( n + 1 ) / ( 1 - q );
end
end
an=@(n)n*((3*n-1)/(4*n+2))^(2*n);
Sumer(an, 0.001),
ans = 0.5729
Упражнение 9
ezplot('1/((2*n-1)*log(2*n))')
grid on
function S = Summ(an,n1,n2);
S=0;
for i=n1:1:n2
S=S+subs(an,i);
end
S;
end
syms n;
I=quad('1./((2.*n-1).*log(2.*n)) ',1,101),
S1=Summ (1/((2*n-1)*log(2*n)),1,100),
S2=Summ (1/((2*n-1)*log(2*n)),2,101),
I = 1.3032
S1 = 2.3228
S2 = 0.8810
Упражнение 10
function S = MSumm(an, eps)
S = 0;
n= 1;
while( abs(an(n)) >= eps )
S = S + an( n );
n = n + 1;
end
end
an=@(n) (-1)^(n-1)/(n^(5/4));
S = lab2_3_7(an, 0.001),
S = 0.7316