matlab第一次作业.docx
《matlab第一次作业.docx》由会员分享,可在线阅读,更多相关《matlab第一次作业.docx(26页珍藏版)》请在冰豆网上搜索。
matlab第一次作业
极限级数练习题
一、
>>symsnkx
>>f=(n+1)*(n+2)*(n+3)/(5*n^3)
f=
((n+1)*(n+2)*(n+3))/(5*n^3)
>>g=[(-2)^n+3^n]/[(-2)^(n+1)+3^(n+1)]
g=
((-2)^n+3^n)/((-2)^(n+1)+3^(n+1))
>>h=exp(-x)*atan(x)
h=
exp(-x)*atan(x)
>>i=(tan(x)-sin(x))/x^3
i=
-(sin(x)-tan(x))/x^3
>>f1=limit(f,inf)
f1=
1/5
>>g1=limit(g,inf)
g1=
1/3
>>h1=limit(h,inf)
h1=
0
>>i1=limit(i,0)
i1=
1/2
二、
>>symsn
>>f=1/(n*(n+1))
f=
1/(n*(n+1))
>>g=sqrt(n/(n+1))
g=
(n/(n+1))^(1/2)
>>h=sin(pi/n*(n+1))
h=
sin((pi*(n+1))/n)
>>i=n*3^n/2^n
i=
1/2^n*3^n*n
>>f1=symsum(f,n,1,inf)
f1=
1
>>g1=symsum(g,n,1,inf)
g1=
sum((n/(n+1))^(1/2),n==1..Inf)
>>h1=symsum(h,n,1,inf)
h1=
(sum(exp(-pi*i)*exp(-(pi*i)/n),n==1..Inf)*i)/2-(sum(exp(pi*i)*exp((pi*i)/n),n==1..Inf)*i)/2>>i1=symsum(i,n,1,inf)
i1=
Inf
因而,第
(1)小题收敛,
(2)(3)(4)小题均发散.
三、
>>symsn
>>s=(-1)^n*(n+1)/3^n
s=
(-1)^n/3^n*(n+1)
>>f=(-1)^n/log(n)
f=
(-1)^n/log(n)
>>h=n/2^n*cos(2*n*pi/3)
h=
1/2^n*n*cos((2*pi*n)/3)
>>s1=symsum(s,n,1,inf)
s1=
-7/16
>>f1=symsum(f,n,2,inf)
f1=
sum((-1)^n/log(n),n==2..Inf)
>>h1=symsum(h,n,1,inf)
h1=
((3^(1/2)*i)/2-1/2)/(4*(3^(1/2)*(i/4)-5/4)^2)-((3^(1/2)*i)/2+1/2)/(4*(3^(1/2)*(i/4)+5/4)^2)
因而,第
(1)、(3)小题收敛,第
(2)小题不收敛.
>>s2=symsum(abs(s),n,1,inf)
s2=
5/4
>>f2=symsum(abs(f),n,2,inf)
f2=
sum(abs((-1)^n)/log(n),n==2..Inf)
>>h2=symsum(abs(h),n,1,inf)
h2=
sum(1/2^n*n*abs(cos((2*pi*n)/3)),n==1..Inf)
因而,第
(1)小题绝对收敛,第
(2)小题不收敛,第(3)小题条件收敛.
四、
>>symsnx
>>s=((2*n-1)*(x^(2*n-2)))/(2^n)
s=
1/2^n*x^(2*n-2)*(2*n-1)
>>f=(x^n)/(n*2^n)
f=
(1/2^n*x^n)/n
>>g=n*(n+1)*x^(n-1)/2
g=
(n*x^(n-1)*(n+1))/2
>>h=x^n/(n*(n+1))
h=
x^n/(n*(n+1))
>>s1=symsum(s,n,1,inf)
s1=
1/4*pi^(1/2)*2^(3/4)*(x^2)^(1/4)/(1-1/2*x^2)^(3/2)*LegendreP(1/2,1/2,(1/2*x^2+1)/(1-1/2*x^2))
>>f1=symsum(f,n,1,inf)
f1=
-log(1-1/2*x)
>>g1=symsum(g,n,1,inf)
g1=
-1/(x-1)^3
>>h1=symsum(h,n,1,inf)
h1=
1-(x-1)/x*log(1-x)
五、
1、>>symsn
>>f=((3^n+5^n)/n)^(1/n)
f=
((3^n+5^n)/n)^(1/n)
>>s=limit(f,n,inf)
s=
5
>>R=1/5
R=
0.2000
2、>>symsn
>>f=(n/(2^n))^(1/(2*n))
f=
(1/2^n*n)^(1/(2*n))
>>f1=limit(f,n,inf)
f1=
2^(1/2)/2
>>R=1/f1
R=
2^(1/2)
六、
>>symsx
>>r=taylor(log(x+1),x,0,'order',9)
r=
-x^8/8+x^7/7-x^6/6+x^5/5-x^4/4+x^3/3-x^2/2+x
>>f=taylor(x^4-5*x^3+x^2-3*x+4,x,4,'order',5)
f=
21*x+37*(x-4)^2+11*(x-4)^3+(x-4)^4-140
>>x=-0.9:
1/50:
1.2
>>y1=log(x+1)
>>y2=-x.^8./8+x.^7./7-x.^6./6+x.^5./5-x.^4./4+x.^3./3-x.^2./2+x
>>plot(x,y1)
>>holdon
>>plot(x,y2,'r')
x=0:
1/100:
8
>>s1=x.^4-5.*x.^3+x.^2-3.*x+4;plot(x,s1)
>>holdon
>>s2=21.*x+37.*(x-4).^2+11.*(x-4).^3+(x-4).^4-140;plot(x,s2,'r')
微分练习题
一、
>>symsx
>>f=(cos(cos(2*x)))^2
f=
cos(cos(2*x))^2
>>dfdx=diff(f,x,2)
dfdx=
8*sin(2*x)^2*sin(cos(2*x))^2-8*sin(2*x)^2*cos(cos(2*x))^2+8*cos(2*x)*cos(cos(2*x))*sin(cos(2*x))
二、
>>symsx
>>g=sym('atan(y/x)=log(sqrt(x^2+y^2))')
g=
atan(y/x)==log((x^2+y^2)^(1/2))
>>g=sym('atan(y(x)/x)=log(sqrt(x^2+y(x)^2))')
g=
atan(y(x)/x)==log((x^2+y(x)^2)^(1/2))
>>dgdx=diff(g,x)
dgdx=
(diff(y(x),x)/x-y(x)/x^2)/(y(x)^2/x^2+1)==(2*x+2*y(x)*diff(y(x),x))/(2*(x^2+y(x)^2))
>>dgdx1=subs(dgdx,'diff(y(x),x)','dydx')
dgdx1=
-(y(x)/x^2-dydx/x)/(y(x)^2/x^2+1)==(2*x+2*dydx*y(x))/(2*(x^2+y(x)^2))
>>dydx=solve(dgdx1,'dydx')
dydx=
(x+y(x))/(x-y(x))
三、
(exp(t)*cos(t)-exp(t)*sin(t))/(exp(t)*cos(t)+exp(t)*sin(t))
>>dydxdt=diff(dydx,t)
dydxdt=
-(2*exp(t)*sin(t))/(exp(t)*cos(t)+exp(t)*sin(t))-(2*exp(t)*cos(t)*(exp(t)*cos(t)-exp(t)*sin(t)))/(exp(t)*cos(t)+exp(t)*sin(t))^2
>>dydx2=dydxdt/dxdt
dydx2=
-((2*exp(t)*sin(t))/(exp(t)*cos(t)+exp(t)*sin(t))+(2*exp(t)*cos(t)*(exp(t)*cos(t)-exp(t)*sin(t)))/(exp(t)*cos(t)+exp(t)*sin(t))^2)/(exp(t)*cos(t)+exp(t)*sin(t))
>>L=(x+y)^2*dydx2
L=
-(exp(t)*cos(t)+exp(t)*sin(t))*((2*exp(t)*sin(t))/(exp(t)*cos(t)+exp(t)*sin(t))+(2*exp(t)*cos(t)*(exp(t)*cos(t)-exp(t)*sin(t)))/(exp(t)*cos(t)+exp(t)*sin(t))^2)
>>R=2*(x*dydx-y)
R=
(2*exp(t)*sin(t)*(exp(t)*cos(t)-exp(t)*sin(t)))/(exp(t)*cos(t)+exp(t)*sin(t))-2*exp(t)*cos(t)
>>L-R
ans=
2*exp(t)*cos(t)-(exp(t)*cos(t)+exp(t)*sin(t))*((2*exp(t)*sin(t))/(exp(t)*cos(t)+exp(t)*sin(t))+(2*exp(t)*cos(t)*(exp(t)*cos(t)-exp(t)*sin(t)))/(exp(t)*cos(t)+exp(t)*sin(t))^2)-(2*exp(t)*sin(t)*(exp(t)*cos(t)-exp(t)*sin(t)))/(exp(t)*cos(t)+exp(t)*sin(t))
>>H=simple(L-R)
H=
0
四、
>>symsxy
>>z=cos(sqrt(x^2+y^2))
z=
cos((x^2+y^2)^(1/2))
>>dzdx=diff(z,x,1)
dzdx=
-(x*sin((x^2+y^2)^(1/2)))/(x^2+y^2)^(1/2)
>>dzdy=diff(z,y,1)
dzdy=
-(y*sin((x^2+y^2)^(1/2)))/(x^2+y^2)^(1/2)
>>dzdxdy=diff(diff(z,x),y)
dzdxdy=
(x*y*sin((x^2+y^2)^(1/2)))/(x^2+y^2)^(3/2)-(x*y*cos((x^2+y^2)^(1/2)))/(x^2+y^2)
五、
>>symsxy
>>g=sym('x+2*y+z(x,y)-2*sqrt(x*y*z(x,y))=0')
g=
x+2*y-2*(x*y*z(x,y))^(1/2)+z(x,y)==0
>>dgdx=diff(g,x)
dgdx=
diff(z(x,y),x)-(x*y*diff(z(x,y),x)+y*z(x,y))/(x*y*z(x,y))^(1/2)+1==0
>>dgdx1=subs(dgdx,'diff(z(x,y),x)','dzdx')
dgdx1=
dzdx-(y*z(x,y)+dzdx*x*y)/(x*y*z(x,y))^(1/2)+1==0
>>dzdx=solve(dgdx1,'dzdx')
dzdx=
-((x*y*z(x,y))^(1/2)-y*z(x,y))/((x*y*z(x,y))^(1/2)-x*y)
>>dgdy=diff(g,y)
dgdy=
diff(z(x,y),y)-(x*y*diff(z(x,y),y)+x*z(x,y))/(x*y*z(x,y))^(1/2)+2==0
>>dgdy1=subs(dgdy,'diff(z(x,y),y)','dzdy')
dgdy1=
dzdy-(x*z(x,y)+dzdy*x*y)/(x*y*z(x,y))^(1/2)+2==0
>>dzdy=solve(dgdy1,'dzdy')
dzdy=
-((x*z(x,y))/(x*y*z(x,y))^(1/2)-2)/((x*y)/(x*y*z(x,y))^(1/2)-1)
选址问题
>>symsx
>>y=20*sqrt(x^2+9)+15*(5-x)
y=
20*(x^2+9)^(1/2)-15*x+75
>>dydx=diff(y,x)
dydx=
(20*x)/(x^2+9)^(1/2)-15
>>z=solve('(20*x)/(x^2+9)^(1/2)-15','x')
z=
(9*7^(1/2))/7
因此,M应建在距离B点(9*7^(1/2))/7米处.
积分练习题
一、
>>symsx
>>s=1/((asin(x))^2*sqrt(1-x^2))
s=
1/(asin(x)^2*(1-x^2)^(1/2))
>>f=cos(x)*sin(x)/(1+cos(x))^2
f=
(cos(x)*sin(x))/(cos(x)+1)^2
>>g=log(x+1)/sqrt(x+1)
g=
log(x+1)/(x+1)^(1/2)
>>h=cos(log(x))
h=
cos(log(x))
>>ints=int(s,x)
ints=
-1/asin(x)
>>intf=int(f,x)
intf=
-log(cos(x)+1)-1/(cos(x)+1)
>>intg=int(g,x)
intg=
2*(log(x+1)-2)*(x+1)^(1/2)
>>inth=int(h,x)
inth=
(x*(cos(log(x))+sin(log(x))))/2
二、
>>symsx
>>s=(1+log(x))/x
s=
(log(x)+1)/x
>>f=x*atan(x)
f=
x*atan(x)
>>g=abs(x-1)
g=
abs(x-1)
>>h=(x*sin(x))^2
h=
x^2*sin(x)^2
>>intf=int(f,x,0,1)
intf=
pi/4-1/2
>>ints=int(s,x,1,exp
(1))
ints=
(log(3060513257434037/1125899906842624)*(log(3060513257434037/1125899906842624)+2))/2
>>intg=int(g,x,0,2)
intg=
1
>>inth=int(h,x,0,x)
inth=
sin(2*x)/8-(x*cos(2*x))/4-(x^2*sin(2*x))/4+x^3/6
三、
>>symsxt
>>f=cos(t^2)
f=
cos(t^2)
>>g=1/(1+t^2)
g=
1/(t^2+1)
>>f1=int(f,t,sin(x),0)
f1=
-(2^(1/2)*pi^(1/2)*fresnelC((2^(1/2)*sin(x))/pi^(1/2)))/2
>>g1=int(g,t,x^2,x^3)
g1=
atan(x^3)-atan(x^2)
>>df1dx=diff(f1,x)
df1dx=
-cos(sin(x)^2)*cos(x)
>>dg1dx=diff(g1,x)
dg1dx=
(3*x^2)/(x^6+1)-(2*x)/(x^4+1)
四、
>>symstx
>>f=sin(t^2)
f=
sin(t^2)
>>g=x^3+x^4
g=
x^4+x^3
>>symsa
>>h=t/sqrt(a+t)
h=
t/(a+t)^(1/2)
>>s=x^4
s=
x^4
>>f1=int(f,t,0,sin(x))
f1=
(2^(1/2)*pi^(1/2)*fresnelS((2^(1/2)*sin(x))/pi^(1/2)))/2
>>h1=int(h,t,0,x^2)
Warning:
Explicitintegralcouldnotbefound.
h1=
piecewise([ainDom:
:
ImageSet(y*i,y,R_)orainR_,(4*a^(3/2))/3-(2*(-x^2+2*a)*(x^2+a)^(1/2))/3],[notainDom:
:
ImageSet(y*i,y,R_)andnotainR_,int(t/(a+t)^(1/2),t==0..x^2)])
>>f2=f1/g
f2=
(2^(1/2)*pi^(1/2)*fresnelS((2^(1/2)*sin(x))/pi^(1/2)))/(2*(x^4+x^3))
>>h2=h1/s
h2=
piecewise([ainDom:
:
ImageSet(y*i,y,R_)orainR_,-((2*(-x^2+2*a)*(x^2+a)^(1/2))/3-(4*a^(3/2))/3)/x^4],[notainDom:
:
ImageSet(y*i,y,R_)andnotainR_,int(t/(a+t)^(1/2),t==0..x^2)/x^4])
>>f3=limit(f2,x,0)
f3=
1/3
>>h3=limit(h2,x,0)
h3=
1/(2*a^(1/2))
六、
>>symsxyt
>>s1=int(exp(t),t,0,y)
s1=
exp(y)-1
>>s2=int(cos(t),t,0,x)
s2=
sin(x)
>>g=sym('exp(y(x))-1+sin(x)=0')
g=
exp(y(x))+sin(x)-1==0
>>dgdx=diff(g,x)
dgdx=
exp(y(x))*diff(y(x),x)+cos(x)==0
>>dgdx1=subs(dgdx,'diff(y(x),x)','dydx')
dgdx1=
cos(x)+dydx*exp(y(x))==0
>>dydx=solve(dgdx1,'dydx')
dydx=
-exp(-y(x))*cos(x)
七、
>>symsx
>>f=sin(sin(x))/x
f=
sin(sin(x))/x
>>g=exp(-x)*x^5.1
g=
x^(51/10)*exp(-x)
>>f1=int(f,x,0,x/2)
Warning:
Explicitintegralcouldnotbefound.
f1=
int(sin(sin(x))/x,x==0..x/2)
>>g1=int(g,x,0,inf))
>>g1=int(g,x,0,inf)
g1=
(14973651*gamma(1/10))/1000000
八、
>>symsxp
>>f=1/x^p
f=
1/x^p
>>s=1/x^2/(1+x)
s=
1/(x^2*(x+1))
>>g=1/(x*sqrt(1-(log(x))^2))
g=
1/(x*(1-log(x)^2)^(1/2))
>>h=exp(-2^x)/(2-x)^2
h=
exp(-2^x)/(x-2)^2
>>f1=int(f,x,1,inf)
Warning:
Explicitintegralcouldnotbefound.
f1=
piecewise([p==1,Inf],[p<1,Inf+1/(p-1)],[1>>g1=int(g,x,1,2)
g1=
asin(log
(2))
>>s1=int(s,x,1,inf)
s1=
1-log
(2)
>>h1=int(h,x,0,2)
Warning:
Explicitintegralcouldnotbefound.
h1=
int(exp(-2^x)/(x-2)^2,x==0..2)
九、
>>symsxy
>>F=int(int(x*y,x,y^2,y+2),y,-1,2)
F=
45/8
十、
>>symsxy
>>F=int(int(exp(-x^2-y^2),y,-sqrt(1-x^2),sqrt(1-x^2)),x,-1,1)
Warning:
Explicitintegralcouldnotbefound.
F=
int(pi^(1/2)*erf((1-x^2)^(1/2))*exp(-x^2),x==-1..1)
十一、
>>symsxyz
>>int(int(int(1,z,x^2+2*y^2,6-2*x^2-y^2),y,-sqrt(2-x^2),sqrt(2-x^2)),x,-2^(1/2),2^(1/2))
ans=
6*pi
十二、
>>symsRAB
>>x=R*cos(A)*cos(B)
x=
R*cos(A)*co