第八章实验指导1、>> syms x y;>> A=x^4-y^4;>> factor(A)ans =(x - y)*(x + y)*(x^2 + y^2)>> a=5135;>> factor(a)ans =5 13 79 2、(1)>> syms x>> f=(x-2)/(x^2-4);>> limit(f,x,2)ans =1/4(2)>> syms xf=(sqrt(pi)-sqrt(acos(x)))/sqrt(x+1); limit(f,x,-1,'right')ans =-Inf3、(1)>> syms x y>> f=sin(1/x);>> diff(f)ans =-cos(1/x)/x^2>> diff(f,x,2)ans =(2*cos(1/x))/x^3 - sin(1/x)/x^4>> f=(1-cos(2x))/x;(2)>> f=(1-cos(2*x))/xf =-(cos(2*x) - 1)/x>> diff(f)ans =(2*sin(2*x))/x + (cos(2*x) - 1)/x^2 >> diff(f,x,2)ans =(4*cos(2*x))/x - (4*sin(2*x))/x^2 - (2*(cos(2*x) - 1))/x^3 4、(1)、>> x=sym('x');>> f=sqrt(exp(x)+1);>> int(f)ans =atan((exp(x) + 1)^(1/2)*i)*2*i + 2*(exp(x) + 1)^(1/2) (2)>> x=sym('x');y=sym('y');f=x/(x+y);>> int(f,y)ans =x*log(x + y)(3)>> syms x;>> f=exp(x)*(exp(x)+1)^2;>> int(f,0,log10(2))ans =(exp(5422874305198591/18014398509481984)*(3*exp(5422874305198 591/18014398509481984) + exp(5422874305198591/9007199254740992) + 3))/3 - 7/3(4)>> sym('x');f=x*log10(x);int(f,1,exp(1))ans =(18733482797859000068490812234738*log(3060513257434037/112589 9906842624) -8099090798701270632748702911993)/(50706024009129176059868128 21504*log(10))5、(1)>> s=symsum((-1)^(n+1)*1/n,1,inf)s =log(2)(2)>> syms n>> s=symsum(x^(2*n-1)/(2*n-1),1,inf)s =piecewise([real(n) < 0, zeta(1 - 2*n)/(2*n - 1)]) 6、(1)>> syms x;>> f=(exp(x)+exp(-1*x))/2;>> taylor(f,x,5,0)ans =x^4/24 + x^2/2 + 1(2)>> syms x;>> f=sqrt(x^3-2*x+1);>> taylor(f,x,6,0)ans =- x^5/8 - x^4/8 - x^2/2 - x + 17、(1)>> syms x a;x=solve('x^3+a*x+1','x')x =((a^3/27 + 1/4)^(1/2) - 1/2)^(1/3) - a/(3*((a^3/27 + 1/4)^(1/2) - 1/2)^(1/3))(3^(1/2)*(a/(3*((a^3/27 + 1/4)^(1/2) - 1/2)^(1/3)) + ((a^3/27 + 1/4)^(1/2) -1/2)^(1/3))*i)/2 + a/(6*((a^3/27 + 1/4)^(1/2) - 1/2)^(1/3)) - ((a^3/27 +1/4)^(1/2) - 1/2)^(1/3)/2a/(6*((a^3/27 + 1/4)^(1/2) - 1/2)^(1/3)) - (3^(1/2)*(a/(3*((a^3/27 + 1/4)^(1/2) - 1/2)^(1/3)) + ((a^3/27 + 1/4)^(1/2) - 1/2)^(1/3))*i)/2 - ((a^3/27 + 1/4)^(1/2) - 1/2)^(1/3)/2(2)>> syms x>> x=solve('sin(x)+2*cos(x)-sqrt(x)=0','x')x =- 227.29614717392215108027554049443 + 2.607041909691930054078218073756*i (3)>> syms x y;>> [x y]=solve('log10(x/y)=9','exp(x+y)=3','x','y') x =(1000000000*log(3))/1000000001y =log(3)/10000000018、思考练习1、(1)数值计算>> 1/2+2/3ans =1.1667符号运算>> p1=sym('1/2'); >> a=sym('2/3'); >> p1+aans =7/6(2)数值计算>> pi+sqrt(5)ans =5.3777 >> a=sym('36'); >> y=36;>> (1+sqrt(a))/2ans =7/2>> c=sym('pi'); >> d=sym('sqrt(5)'); >> c+dans =pi + 5^(1/2)(3)数值计算>> (1+sqrt(36))/2ans =3.5000符号计算>> a=sym('36'); >> y=36;>> (1+sqrt(a))/2ans =2、>> syms x B1 B2 a bs1=2*((cos(x))^2)-(sin(x))^2;s2=sin(B1)*cos(B2)-cos(B1)*sin(B2);s3=sqrt((a+sqrt(a^2-b))/2)+sqrt((a-sqrt(a^2-b))/2); s4=(4*x^2+8*x+3)/(2*x+1);h1=simplify(s1)h2=simplify(s2)h3=simplify(s3)h4=simplify(s4)h1 =3*cos(x)^2 - 1h2 =sin(B1 - B2)(2^(1/2)*((a + (a^2 - b)^(1/2))^(1/2) + (a - (a^2 - b)^(1/2))^(1/2)))/2 h4 =2*x + 33、>> syms x a;f=abs(x)/x;limit(f,x,0,'left')ans =-1(2)>> f=(x+a/x)^x;limit(f,x,inf)ans =4、(1)>> syms x y mf=sqrt(x+sqrt(x+sqrt(x)));m=diff(f,'x')diff(m,'x')m =((1/(2*x^(1/2)) + 1)/(2*(x + x^(1/2))^(1/2)) + 1)/(2*(x + (x +x^(1/2))^(1/2))^(1/2))ans =- ((1/(2*x^(1/2)) + 1)/(2*(x + x^(1/2))^(1/2)) + 1)^2/(4*(x + (x +x^(1/2))^(1/2))^(3/2)) - (1/(8*x^(3/2)*(x + x^(1/2))^(1/2)) + (1/(2*x^(1/2)) +1)^2/(4*(x + x^(1/2))^(3/2)))/(2*(x + (x + x^(1/2))^(1/2))^(1/2))(2)>> syms x y;f=x+y-sqrt(x^2+y^2);z1=diff(f,x)z2=diff(f,y)z1 =1 - x/(x^2 + y^2)^(1/2)z2 =1 - y/(x^2 + y^2)^(1/2)5、>> syms x;>> f=1/sin(x);>> int(f)ans =log(tan(x/2))(2)>> sym x;f=1/(asin(x)^2*(1-x^2)^(1/2)); int(f)ans =-1/asin(x)5、(1)>> syms x>> f=1/(1+sqrt(x));>> int(f,0,4)ans =4 - log(9)(2) sym x;f=x^3*sin(x)^2/(x^6+2*x^4+1);int(f,-1,1)Warning: Explicit integral could not be found. ans =int((x^3*sin(x)^2)/(x^6 + 2*x^4 + 1), x == -1..1) 7、(1)>> syms ns=symsum(1/4^n,1,inf)s =1/3(2)、>> sym n;s=symsum(((n+1)/n)^(1/2),1,inf) eval(y)s =sum(((n + 1)/n)^(1/2), n == 1..Inf) ans =y8、(1)>> syms xf=tan(x);taylor(f,x,3,0)x(2)、>> syms xf=sin(x)^2;taylor(f,x,5,0)ans =- x^4/3 + x^29、(1)>> syms xx=solve('log(1+x)-5/(1+sin(x))=2','x')x =521.67926389905839979437366649258(2)syms x y z>> [x yz]=solve('4*x^2/(4*x^2+1)=y','4*y^2/(4*y^2+1)=z','4*z^2/(4*z^2+1)=x','x' ,'y','z')1/2- 20.0*z^5 - 21.617977528089887640449438202247*z^4 - 1.2359550561797752808988764044944*z^3 +3.6741573033707865168539325842697*z^2 -0.058988764044943820224719101123596*z -0.011235955056179775280898876404494y =1/2156.0*z^5 + 110.82022471910112359550561797753*z^4 + 10.404494382022471910112359550562*z^3 +2.5337078651685393258426966292135*z^2 +0.30056179775280898876404494382022*z +0.097612359550561797752808988764045z =1/2Z10、>> [x ,y]=dsolve('Dx=3*x+4*y','Dy=5*x-7*y','x(0)=0','y(0)=1','t')x =-(exp(-t*(3*5^(1/2) + 2))*((3*5^(1/2))/2 - (5^(1/2)*(3*5^(1/2) + 5))/6 +5*exp(t*(3*5^(1/2) - 2))*exp(t*(3*5^(1/2) + 2))*(5^(1/2)/6 - 1/2) +3*5^(1/2)*exp(t*(3*5^(1/2) - 2))*exp(t*(3*5^(1/2) + 2))*(5^(1/2)/6 - 1/2) + 5/2))/5y =exp(-t*(3*5^(1/2) + 2))*((5^(1/2)*(3*5^(1/2) + 5))/30 - exp(t*(3*5^(1/2) - 2))*exp(t*(3*5^(1/2) + 2))*(5^(1/2)/6 - 1/2))。