习题2.1画出下列常见曲线的图形(1)立方抛物线3xy命令:symsxy;ezplot('x.^(1/3)')(2)高斯曲线y=e^(-X^2);命令:clearsymsxy;ezplot('exp(-x*x)')(3)笛卡尔曲线命令:clearsymsxy;a=1;ezplot(x^3+y^3-3*a*x*y)(4)蔓叶线命令:clearsymsxy;a=1ezplot(y^2-(x^3)/(a-x))(5)摆线:tbyttaxcos1,sin命令:cleart=0:0.1:2*pi;x=t-sin(t);y=2*(1-cos(t));plot(x,y)7螺旋线命令:cleart=0:0.1:2*pi;x=cos(t);y=sin(t);z=t;plot3(x,y,z)(8)阿基米德螺线命令:cleartheta=0:0.1:2*pi;rho1=(theta);subplot(1,2,1),polar(theta,rho1)(9)对数螺线命令:cleartheta=0:0.1:2*pi;rho1=exp(theta);subplot(1,2,1),polar(theta,rho1)(12)心形线命令:cleartheta=0:0.1:2*pi;rho1=1+cos(theta);subplot(1,2,1),polar(theta,rho1)练习2.21.求出下列极限值(1)nnnn3lim3命令:symsnlimit((n^3+3^n)^(1/n))ans=3(2))121(limnnnn命令:symsnlimit((n+2)^(1/2)-2*(n+1)^(1/2)+n^(1/2),n,inf)ans=0(3)xxx2cotlim0命令:symsx;limit(x*cot(2*x),x,0)ans=1/2(4))(coslimcmxx命令:symsxm;limit((cos(m/x))^x,x,inf)ans=1(5))111(lim1exxx命令:symsxlimit(1/x-1/(exp(x)-1),x,1)ans=(exp(1)-2)/(exp(1)-1)(6))(2limxxxx命令:symsxlimit((x^2+x)^(1/2)-x,x,inf)ans=1/2练习2.41.求下列不定积分,并用diff验证:(1)xdxcos1Clearsymsxyy=1/(1+cos(x));f=int(y,x)f=tan(1/2*x)y=tan(1/2*x);yx=diff(y,x);y1=simple(yx)y1=1/2+1/2*tan(1/2*x)^2(2)exdx1clearsymsxyy=1/(1+exp(x));f=int(y,x)f=-log(1+exp(x))+log(exp(x))symsxyy=-log(1+exp(x))+log(exp(x));yx=diff(y,x);y1=simple(yx)y1=1/(1+exp(x))(3)dxxxsin2symsxyy=x*sin(x)^2;f=int(y,x)f=x*(-1/2*cos(x)*sin(x)+1/2*x)-1/4*cos(x)^2-1/4*x^2clearsymsxyy=x*(-1/2*cos(x)*sin(x)+1/2*x)-1/4*cos(x)^2-1/4*x^2;yx=diff(y,x);y1=simple(yx)y1=x*sin(x)^2(4)xdxsec3symsxyy=sec(x)^3;f=int(y,x)f=1/2/cos(x)^2*sin(x)+1/2*log(sec(x)+tan(x))clearsymsxyy=1/2/cos(x)^2*sin(x)+1/2*log(sec(x)+tan(x));yx=diff(y,x);y1=simple(yx)y1=1/cos(x)^32.求下列积分的数值解1)dxxx10clearsymsxy=int(x^(-x),x,0,1)y=int(x^(-x),x=0..1)vpa(y,10)ans=1.2912859972)xdxexcos3202clearsymsxy=int(exp(2*x)*cos(x)^3,x,clearsymsxy=int((1/(2*pi)^(1/2))*exp(-x^2/2),x,0,1)y=7186705221432913/36028797018963968*erf(1/2*2^(1/2))*2^(1/2)*pi^(1/0,2*pi)y=22/65*exp(pi)^4-22/65vpa(ans,10)(3)dxxe210221clearsymsxy=int(1/(2*pi)^(1/2)*exp(-x^2/2),0,1);vpa(y,14)ans=.341344746068552(4)clearsymsxy=int(x*log(x^4)*asin(1/x^2),1,3);Warning:Explicitintegralcouldnotbefound.Insym.intat58vpa(y,14)ans=2.45977212823752(5)clearsymsxy=int(1/(2*pi)^(1/2)*exp(-x^2/2),-inf,inf);vpa(y,14)ans=.99999999999999练习2.51判断下列级数的收敛性,若收敛,求出其收敛值。1)symsns1=symsum(1/n^(2^n),n,1,inf)s1=sum(1/(n^(2^n)),n=1..Inf)vpa(s1,10)ans=1.062652416因此不收敛2)symsns1=symsum(sin(1/n),n,1,inf)s1=sum(sin(1/n),n=1..Inf)vpa(s1,10)ans=sum(sin(1/n),n=1..Inf)不收敛(3)clearsymsns=symsum(log(n)/n^3,n,1,inf)s=-zeta(1,3)收敛(4)symsns1=symsum(1/(log10(n))^n,n,3,inf)s1=sum(1/((log(n)/log(10))^n),n=3..inf)不收敛(5)symsns1=symsum(1/n*log10(n),n,2,inf)s1=sum(1/n*log(n)/log(10),n=2..Inf)不收敛(6)clearsymsns=symsum((-1)^n*n/n^2+1,n,1,inf)s=sum((-1)^n/n+1,n=1..Inf)不收敛习题3.11)clear;[x,y]=meshgrid(-30:0.3:30);z=10*sin(sqrt(x.^2+y.^2))./sqrt(1+x.^2+y.^2);meshc(x,y,z)clear[x,y]=meshgrid(-30:0.1:30);z=10*sin((x^2+y^2)^(1/2))/(1+x^2+y^2)^(1/2)mesh(x,y,z)1.2.取适当的参数绘制下列曲面的图形。(1)cleara=-2:0.1:2;b=-3:0.1:3;[x,y]=meshgrid(a,b);z=(1-(x.^2)/4-(y.^2)/9).^(1/2);mesh(x,y,z)holdonmesh(x,y,-z)(2)cleara=-1:0.1:1;b=-2:0.1:2;[x,y]=meshgrid(a,b);z=(4/9)*(x.^2)+(y.^2);mesh(x,y,z)(4)clear[x,y]=meshgrid(-1:0.1:1);z=(1/3)*(x.^2)-(1/3)*(y.^2);mesh(x,y,z)习题3.2P49/例3.2.1命令:symsxylimit(limit((x^2+y^2)/(sin(x)+cos(y)),0),pi),ans=-pi^2limit(limit((1-cos(x^2+y^2))/((x^2+y^2)),0),0),ans=0P49/例3.2.2命令:clear;symsxyzdxdydzzxzzyzxxzxyz=atan(x^2*y)z=atan(x^2*y)zx=diff(z,x),zy=diff(z,y)zx2*x*y/(1+x^4*y^2)zy=x^2/(1+x^4*y^2)dz=zx*dx+zy*dy,dz=2*x*y/(1+x^4*y^2)*dx+x^2/(1+x^4*y^2)*dzxx=diff(zx,x),zxy=diff(zx,y)zxx=2*y/(1+x^4*y^2)-8*x^4*y^3/(1+x^4*y^2)^2zxy=2*x/(1+x^4*y^2)-4*x^5*y^2/(1+x^4*y^2)^23.2.1作图表示函数z=x*exp(-x^2-y^2)(-1x1,0y2)沿x轴方向梯度cleara=-1:0.1:1;b=0:0.1:2;[x,y]=meshgrid(a,b);z=x.*exp(-x.^2-y.^2);[px,py]=gradient(z,0.1,0.1);contour(a,b,z),holdon,quiver(a,b,px,py),holdoff习题3.41.解下列微分方程(1)y=dsolve('Dy=x+y','y(0)=1','x')y=-x-1+2*exp(x)x=[123]x=123-x-1+2*exp(x)ans=3.436611.778136.1711(2)x'=2*x+3*y,y'=2*x+y,x(0)=-2,y(0)=2.8,0t10,做相平面图新建M函数functiondy=weifen1(t,y)dy=zeros(2,1);dy(1)=2*y(1)+3*y(2);dy(2)=2*y(1)+y(2);输入命令t=0:0.1:10;[t,y]=ode15s('weifen1',[0,10],[-22.8]);plot(t,y)(3)y''-0.01(y')^2+2*y1=sin(t),y(0)=0,y'(0)=1,0t5,做y的图新建M函数functiondy=weifen2(t,y)dy=zeros(2,1);dy(1)=y(2);dy(2)=0.01*y(2)^2-2*y(1)+sin(t);输入命令[t,y]=ode15s('weifen2',[0,5],[01]);plot(t,y)1.绘制飞船轨迹图新建M函数functiondy=weifen3(t,y)dy=zeros(4,1);dy(1)=y(3);dy(2)=y(4);dy(3)=2*y(4)+y(1)-(1-1/82.45)*(y(1)+1/82.45)/((y(1)+1/82.45)^2+y(2)^2)^(3/2)-(1/82.45)*(y(1)+1/82.45-1)/((y(1)+1-1/82.45)^2+y(2)^2)^(3/2);dy(4)=-2*y(3)+y(2)-(1-1/82.45)*y(2)^2/((y(1)+1/82.45)^2+y(2)^2)^(3/2)-(1/82.45)*y(2)/((y(1)+1-1/82.45)^2+y(2)^2)^(3/2);输入命令[t,y]=ode15s('weifen3',[0,10],[1.200-1]);plot(t,y)习题4.14.1.5(1)clearp=[101];q=[10001];[a,b,r]=residue(p,q)a=-0.0000-0.3536i-0.0000