1、1 创建符号表达式。参考答案: f = sym(sin(x)+x);2. 计算习题 1 中表达式在处的值,并将结果设置为以下 5 种精度:小数点之后 1 位、2 位、5 位、10位和20位有效数字。参考答案: digits(1) vpa(subs(f,x,pi/6) ans = 1. digits(2) vpa(subs(f,x,pi/6) ans = 1.0 digits(5) vpa(subs(f,x,pi/6) ans = 1.0236 digits(10) vpa(subs(f,x,pi/6) ans = 1.0235987763设为符号变量,试进行如下运算:(1)(2)(3)求的反函
2、数(4)求以为自变量的复合函数参考答案: f = sym(x4 + x2 + 1); g = sym(x3 + 4*x2 + 5*x + 8);(1) f+g ans = x4+5*x2+9+x3+5*x (2) f*g ans = (x4+x2+1)*(x3+4*x2+5*x+8) (3) finverse(g)Warning: finverse(x3 + 4*x2 + 5*x + 8) is not unique. In sym.finverse at 43 ans = 1/6*(-656+108*x+12*(2988-984*x+81*x2)(1/2)(1/3)+2/3/(-656+10
3、8*x+12*(2988-984*x+81*x2)(1/2)(1/3)-4/3 (4) syms x compose(g,f,x) ans = (x4+x2+1)3+4*(x4+x2+1)2+5*x4+5*x2+134合并同类项(1)(3)(对和)参考答案:(1) f = sym(3*x - 2*x2 + 5 + 3*x2 - 2*x -5); collect(f) ans = x+x2(2) f = sym(2*x2 - 3*x*y + y2 - 2*x*y - 2*x2 + 5*x*y - 2*y + 1); collect(f) ans = y2-2*y+15因式分解(1)将 77986
4、66 进行因数分解,分解为素数乘积的形式(2)(3)参考答案:(1) factor(sym(779866) ans = (2)*(149)*(2617)(2) factor(sym(-2*m8 + 512) ans = -2*(m-2)*(m+2)*(m2+4)*(m4+16)(3) factor(sym(3*a2*(x-y)3 - 4*b2*(y-x)2) ans = (x-y)2*(3*a2*x-4*b2-3*a2*y)6绘制下列函数的图像(1),(2),参考答案:(1) f = sym(sin(x) + x2); ezplot(f,0,2*pi);(2) f = sym(x3 + 2*x
5、2 + 1); ezplot(f,-2 2);7计算下列各式(1)(2),求(3),求,(4),参考答案:(1) limit(sym(tan(x) - sin(x)/(1-cos(2*x) ans = 0(2) y = sym(x3 - 2*x2 + sin(x); diff(y) ans = 3*x2-4*x+cos(x)(3) f = x*y*log(x+y); fx = diff(f,x) fx = y*log(x+y)+x*y/(x+y) fy = diff(f,y) fy = x*log(x+y)+x*y/(x+y) f2xy = diff(fx,y) f2xy = log(x+y)
6、+y/(x+y)+x/(x+y)-x*y/(x+y)2(4) syms t y = log(1+t); int(y) ans = log(1+t)*(1+t)-t-1 int(y,0,27) ans = 56*log(2)+28*log(7)-278计算下列各式(1)(2)(3)在 0 附近的Taylor 展开参考答案:(1) symsum(sym(3/n)n),1,inf) ans = sum(3/n)n,n = 1 . Inf)(2) symsum(sym(2n*sin(pi/(3n),1,inf) ans = 3(1/2)(3) taylor(sym(sin(x) ans = x-1/6
7、*x3+1/120*x59求解线性方程组参考答案: x,y = solve(sym(2*x+3*y=1),sym(3*x+2*y=-1)x =-1y =110对符号表达式,进行如下变换(1)关于的傅立叶变换(2)关于的拉普拉斯变换(3)分别关于和的 Z 变换参考答案:(1) syms x y z = x*exp(-(x2+y2); syms u v fourier(z,x,u) ans = -1/2*i*pi(1/2)*u*exp(-y2-1/4*u2)(2) laplace(z,y,v) ans = 1/2*x*exp(-x2)*pi(1/2)*exp(1/4*v2)*erfc(1/2*v)(3) ztrans(z,x,u) ans = -u*diff(ztrans(exp(-x2-y2),x,u),u) ztrans(z,y,v) ans = x*ztrans(exp(-x2-y2),y,v)11绘制函数在,上的表面图参考答案: syms x y z = 1/(2*pi)*exp(-(x2+y2); ezsurf(x,y,z,-3,3,-3,3);