2、('sin(w*t)'),1)findsym(sym('a*exp(-X)'),1)findsym(sym('z*exp(j*th)'),1)%习题2-3symsxapositivex_1=solve('x^3-44.5')symsxunrealx_2=solve('x^2-a*x+a^2')symsaunrealx_2=solve('x^2-a*x+a^2')x_3=solve('x^2-a*x-a^2')symsxrealevalin(symengine,'anames(Properties
3、)')evalin(symengine,'getprop(x)')%习题2-47/3,pi/3,pi*3^(1/3)a=pi*3^(1/3),b=sym(pi*3^(1/3)),c=sym(pi*3^(1/3),'d'),d=sym('pi*3^(1/3)')vpa(abs(a-d)),vpa(abs(b-d)),vpa(abs(c-d))%习题2-5symsa11a12a13a21a22a23a31a32a33A=[a11a12a13;a21a22a23;a31a32a33]a=det(A)B
4、=inv(A)C=subexpr(B)[RS,w]=subexpr(B,'w')%习题2-6symsksymsapositive%fk=a^k*heaviside(k)fk=a^ks=symsum(fk,k,0,inf)%习题2-7clearallsymsksymsxpositivefk=2/(2*k+1)*(((x-1)/(x+1))^(2*k+1))s=symsum(fk,k,0,inf)s1=simple(s)%习题2-8clearall,symsty=abs(sin(t))df=diff
5、(y),class(df)df1=limit(df,t,0,'left')df2=subs(df,'t',sym(pi/2))%习题2-9clearall,symsx;f=exp(-abs(x)).*abs(sin(x));fint=int(f,x,-5*pi,1.7*pi),digits(64),vpa(fint)class(fint)%习题2-10clearall,symsxy,f=x.^2+y.^2,fint=(int(int(f,y,1,x.^2),x,1,2)),double(fint
6、)%习题2-11clearall,symstx;f=sin(t)/t,yx=int(f,t,0,x),ezplot(yx,[02*pi])fint=subs(yx,x,4.5),%或yxd=int(f,t,0,4.5),fint=double(yxd)holdon,plot(4.5,fint,'*r')%习题2-12%clearall,symsxn;f=(sin(x))^n;yn=int(f,'x',0,pi/2),class(yn)clearall,symsxn;symsnpositive;f
7、=(sin(x))^n;yn=int(f,'x',0,pi/2),class(yn)%y(1/3)=?yn1=subs(yn,'n',sym(1/3)),vpa(yn1)%或yn=limit(yn,n,1/3),vpa(yn)%或yy=int(sin(x).^(1/3),x,0,pi/2),vpa(yy)%习题2-23clear,symsxySS=dsolve('Dy*y/5+x/4=0','x')ezplot(subs(S(1),'C3',1),[-2,2-2,2],1),holdonezpl
8、ot(subs(S(2),'C3',1),[-2,2-2,2],1)%解为S=%2^(1/2)*(C3-(5*x^2)/8)^(1/2)%-2^(1/2)*(C3-(5*x^2)/8)^(1/2)ezplot(subs(S(1),'C3',1),[-2,2-2,2],1),holdonezplot(subs(S(2),'C3',1),[-2,2-2,2],1)%用此两条指令绘圆,在y=0处有间隙ezplot(subs(y^2-(S(1))^2,'C3',1),[-2,2-2,2],2)%用椭圆方