电子一班王申江实验十符号计算基础与符号微积分一、实验目的1、掌握定义符号对象的方法2、掌握符号表达式的运算法则及符号矩阵运算3、掌握求符号函数极限及导数的方法4、掌握求符号函数定积分和不定积分的方法二、实验内容1、已知x=6,y=5,利用符号表达式求13xzxy提示:定义符号常数'6','5'xsymysym。x=sym('6'),y=sym('5')x=6y=5z=(x+1)/(sqrt(3+x)-sqrt(y))z=7/(3-5^(1/2))2、分解因式(1)44xyx=sym('x')x=xy=sym('y')y=yA=x^4-y^4A=x^4-y^4factor(A)ans=(x-y)*(x+y)*(x^2+y^2)(2)5135factor(sym('5135'))ans=(5)*(13)*(79)3、化简表达式(1)1212sincoscossinbyte1=sym('byte1')byte1=byte1byte2=sym('byte2')byte2=byte2S=sin(byte1)*cos(byte2)-cos(byte1)*sin(byte2)S=sin(byte1)*cos(byte2)-cos(byte1)*sin(byte2)simplify(S)ans=sin(byte1)*cos(byte2)-cos(byte1)*sin(byte2)(2)248321xxxx=sym('x')x=xS=(4*x^2+8*x+3)/(2*x+1)S=(4*x^2+8*x+3)/(2*x+1)simple(s)simple(S)simplify:2*x+3radsimp:2*x+3combine(trig):2*x+3factor:2*x+3expand:4/(2*x+1)*x^2+8/(2*x+1)*x+3/(2*x+1)combine:(4*x^2+8*x+3)/(2*x+1)convert(exp):(4*x^2+8*x+3)/(2*x+1)convert(sincos):(4*x^2+8*x+3)/(2*x+1)convert(tan):(4*x^2+8*x+3)/(2*x+1)collect(x):(4*x^2+8*x+3)/(2*x+1)ans=2*x+34、已知12010100100,010,001101abcPPAdefghi完成下列运算:(1)B=P1P2AP1=[010;100;001]P1=010100001P2=[100;010;101]P2=100010101a=sym('a');b=sym('b');c=sym('c');d=sym('d');e=sym('e');f=sym('f');g=sym('g');h=sym('h');i=sym('i');A=[abc;def;ghi]A=[a,b,c][d,e,f][g,h,i]B=P1*P2*AB=[d,e,f][a,b,c][a+g,b+h,c+i](2)B的逆矩阵并验证结果C=inv(B)C=[(i*b-c*h)/(i*d*b-d*c*h-i*a*e+a*f*h+g*e*c-g*f*b),(-e*c-i*e+f*b+f*h)/(i*d*b-d*c*h-i*a*e+a*f*h+g*e*c-g*f*b),-(-e*c+f*b)/(i*d*b-d*c*h-i*a*e+a*f*h+g*e*c-g*f*b)][-(i*a-c*g)/(i*d*b-d*c*h-i*a*e+a*f*h+g*e*c-g*f*b),-(-d*c-i*d+f*a+f*g)/(i*d*b-d*c*h-i*a*e+a*f*h+g*e*c-g*f*b),(-d*c+f*a)/(i*d*b-d*c*h-i*a*e+a*f*h+g*e*c-g*f*b)][(a*h-b*g)/(i*d*b-d*c*h-i*a*e+a*f*h+g*e*c-g*f*b),(-d*b-d*h+e*a+e*g)/(i*d*b-d*c*h-i*a*e+a*f*h+g*e*c-g*f*b),-(-d*b+e*a)/(i*d*b-d*c*h-i*a*e+a*f*h+g*e*c-g*f*b)](3)包括B矩阵主对角线元素的下三角阵tril(B)ans=[d,0,0][a,b,0][a+g,b+h,c+l](4)B的行列式值det(B)ans=i*d*b-d*c*h-i*a*e+a*f*h+g*e*c-g*f*b5、用符号方法求下列极限或导数22sintan31'''3222220,11211limsinarccos2lim11cos23,4cosln5,2,xxxxxyxyxyxeexxxxyyyxatdAdAdAAdxdtdxdttxxyffxyxxexxy求已知,分别求、、已知求、(1)x=sym('x')x=xf=(x*(exp(sin(x))+1)-2*(exp(tan(x))-1))/sin(x).^3f=(x*(exp(sin(x))+1)-2*exp(tan(x))+2)/sin(x)^3limit(f)ans=-1/2(2)x=sym('x')x=xf=(sqrt(pi)-sqrt(acos(x)))/sqrt(x+1)f=(3991211251234741/2251799813685248-acos(x)^(1/2))/(x+1)^(1/2)limit(f,x,-1,'right')ans=-inf(3)x=sym('x')x=xy=(1-cos(2*x))/xy=(1-cos(2*x))/xdiff(y,x,1)ans=2*sin(2*x)/x-(1-cos(2*x))/x^2diff(y,x,2)ans=4*cos(2*x)/x-4*sin(2*x)/x^2+2*(1-cos(2*x))/x^3(4)x=sym('x')x=xy=(1-cos(2*x))/xy=(1-cos(2*x))/xdiff(y,x,1)ans=2*sin(2*x)/x-(1-cos(2*x))/x^2diff(y,x,2)ans=4*cos(2*x)/x-4*sin(2*x)/x^2+2*(1-cos(2*x))/x^3symsatx;f=sym('[a^x,t^3;t*cos(x),log(x)]')f=[a^x,t^3][t*cos(x),log(x)]diff(f,x,1);diff(f,x,1)ans=[a^x*log(a),0][-t*sin(x),1/x]diff(f,t,2)ans=[0,6*t][0,0]diff(f,x)/diff(f,t)ans=[0,1/cos(x)*a^x*log(a)][1/3/t^2/x,-1/cos(x)*t*sin(x)](5)symsxyf=(x.^2-2.*x).*exp(-x.^2-y.^2-x.*y)f=(x^2-2*x)*exp(-x^2-y^2-x*y)diff(y,x)ans=0a=diff(f,x)/diff(f,y)a=((2*x-2)*exp(-x^2-y^2-x*y)+(x^2-2*x)*(-2*x-y)*exp(-x^2-y^2-x*y))/(x^2-2*x)/(-2*y-x)/exp(-x^2-y^2-x*y)x=0;y=1;eval(a)ans=Inf6、用符号方法求下列积分48222042ln20112arcsin113141xxdxxxdxxxxdxxeedx(1)sym('x')ans=xf=1/(1+x^4+x^8)f=1/(1+x^4+x^8)int(f,x)ans=1/6*3^(1/2)*atan(1/3*(2*x-1)*3^(1/2))+1/6*3^(1/2)*atan(1/3*(1+2*x)*3^(1/2))-1/12*3^(1/2)*log(-x^2+3^(1/2)*x-1)+1/12*3^(1/2)*log(x^2+3^(1/2)*x+1)(2)sym('x')ans=xf=1/(asin(x).^2.*sqrt(1-x.^2))f=1/asin(x)^2/(1-x^2)^(1/2)int(x)ans=1/2*x^2(3)symsxf=(x.^2+1)/(x.^4+1)f=(x^2+1)/(1+x^4)int(f,x,0,inf)ans=1/2*pi*2^(1/2)(4)symsxf=exp(x).*(1+exp(x)).^2f=exp(x)*(1+exp(x))^2int(f,x,0,log(2))ans=-7/3+exp(6243314768165359/9007199254740992)+exp(6243314768165359/9007199254740992)^2+1/3*exp(6243314768165359/9007199254740992)^3