KeytoMatlabExercise7SchoolofMathematicalSciencesXiamenUniversityhttp:/gdjpkc.xmu.edr Key to matlab Exercise 7--calculus > clear; syms yl ux; y1=(l+ur2y(1/2): u exp(-x) >> yl= compose(yl, u, x) Or > clear; syms x: uexp(-x): yl=(1+ur2r(1/2) no recommend yI (1+exp(-x)y2)(1/2) > clear; syms y2 uvx; y2=(1+ur2y(1/2); u=log(v); v=exp(-x) > u x=compose(u, v, x); y2=compose(y2, u x, x) Or > clear; syms y2 uvx; y2=(1+ur2r(1/2); UFlog(v); v=exp(-X) > y2=compose(y2, compose(u, v, x)) > clear; syms x; v=exp(x); LFlog(v); y2=(1+ur2)(1/2) no recommend (1+log(exp(-x)y2)(1/2) > clear; syms y uv wx: y=(l+ur2y(1/2); uFlog(v); v=sin( w); w=exp(-x) >>v x=compose(v, w, x); u x=compose(u, v x, x): y=compose(y, u x, x) Or > clear; syms y uv; y=(l+ur2y(1/2); fLog(v): v=sin( w); w=exp(-x) e(y, compose(u, compose(v, w, x)) > clear; syms x; w=exp(-x); v=sin(w): u=log(v): y=(1+u2r(1/2) no recommend (1+log(sin(exp(-x)^2)(1/2) > clear; syms x y; y=(l+(log(sin(x))2y(1/2) > inverse(y, x) Warning: inverse((1+log(sin(x)2y(1/2) is not unique In sym. inverse at 43 ans asn(exp(-1+x2)(1/2) > clear; syms x u y, y=(x+log(sin(u))r(1/2) > inverse(y ans asin(exp(-X+ur2))
Key to MATLAB Exercise 7 School of Mathematical Sciences Xiamen University http://gdjpkc.xmu.edu.cn Key to Ex71 Key to MATLAB Exercise 7 – Calculus 1. 1) >> clear; syms y1 u x; y1=(1+u^2)^(1/2); u= exp(x); >> y1= compose(y1,u,x) Or >> clear; syms x; u=exp(x); y1=(1+u^2)^(1/2) % no recommend y1 = (1+exp(x)^2)^(1/2) 2) >> clear; syms y2 u v x; y2=(1+u^2)^(1/2); u =log(v); v=exp(x); >> u_x=compose(u,v,x); y2=compose(y2,u_x,x) Or >> clear; syms y2 u v x; y2=(1+u^2)^(1/2); u=log(v); v=exp(x); >> y2=compose(y2, compose(u, v, x)) Or >> clear; syms x; v=exp(x); u=log(v); y2=(1+u^2)^(1/2) % no recommend y2 = (1+log(exp(x))^2)^(1/2) 3) >> clear; syms y u v w x; y=(1+u^2)^(1/2); u=log(v); v=sin(w); w=exp(x); >> v_x=compose(v,w,x); u_x=compose(u,v_x,x); y=compose(y,u_x,x) Or >> clear; syms y u v w x; y=(1+u^2)^(1/2); u=log(v); v=sin(w); w=exp(x); >> y=compose(y, compose(u, compose(v, w, x))) Or >> clear; syms x; w=exp(x); v=sin(w); u=log(v); y=(1+u^2)^(1/2) % no recommend y = (1+log(sin(exp(x)))^2)^(1/2) 2. 1) >> clear; syms x y; y=(1+(log(sin(x)))^2)^(1/2); >> finverse(y,x) Warning: finverse((1+log(sin(x))^2)^(1/2)) is not unique. > In sym.finverse at 43 ans = asin(exp((1+x^2)^(1/2))) 2) >> clear; syms x u y; y=(x+log(sin(u)))^(1/2); >> finverse(y,u) ans = asin(exp(x+u^2)) 3)
Key to MATLAB Exercise 7 School of Mathematical Science http:/edjpkc.xmu.ed > clear; syms x uy; y=(x+log(sin(u)))(1/2) >>inverse(y, x) log(sin(u))+x > syms x yl y2; yl=sin(x), y2=asin(sin(x) >> x0=sym(pi/4): subs(y 1, xO) l/2*2^(1/2) ans 1/4 > syms x yl y2, yl=sin(x); y2=asin(sin(x)) > compose(yl, pi/4 ans 1/2*2^(1/2) > compose(y2, pi/4) l/4*p 4 > clear; syms n mx; yl=(tan(n*)-sin(m*x))/x Or > clear; syms n mx, yl=(tan(n*x)-sin(m*x))/x; n-m >> clear; syms x y, y2=(exp(x)-exp(y))/(x-y) >>limit(y2, x,y) ans exp(y) 3) > clear; syms x: y3=x3/(2*x+100) > limit(y3, x, +inf) ans > clear; syms x; y4=x 3/sin(x); ans NaN Ex7-2
Key to MATLAB Exercise 7 School of Mathematical Sciences Xiamen University http://gdjpkc.xmu.edu.cn Key to Ex72 >> clear; syms x u y; y=(x+log(sin(u)))^(1/2); >> finverse(y,x) ans = log(sin(u))+x^2 3. >> syms x y1 y2; y1=sin(x); y2=asin(sin(x)); >> x0=sym(pi/4); subs(y1,x0) ans = 1/2*2^(1/2) >> subs(y2,x0) ans = 1/4*pi Or >> syms x y1 y2; y1=sin(x); y2=asin(sin(x)); >> compose(y1,pi/4) ans = 1/2*2^(1/2) >> compose(y2,pi/4) ans = 1/4*pi 4. 1) >> clear; syms n m x; y1=(tan(n*x)sin(m*x))/x; >> limit(y1,0) Or >> clear; syms n m x; y1=(tan(n*x)sin(m*x))/x; >> limit(y1) ans = nm 2) >> clear; syms x y; y2=(exp(x)exp(y))/ (xy); >> limit(y2,x,y) ans = exp(y) 3) >> clear; syms x; y3=x^3/(2*x+100); >> limit(y3,x,+inf) ans = Inf 4) >> clear; syms x; y4=x^3/sin(x); >> limit(y4,x,inf) ans = NaN
Key to MATLAB Exercise 7 School of Mathematical Sciences Xiamen Univer http:/edjpkc.xmu.ed > clear; syms x; y5=(tan(x)(tan(x))) > limit(y5, x, pi/4, right) ans > clear; syms x; y=tan(x/2) >>limit(y, x, pi, left") 5.1) > clear; syms x n h, y=((x+h)n-x'n >>Limit(y, h,0) > simplify(z)) ans x^(-1+n)°n >>clear; syms xn, yxn, ans > simplify(difi(y, x)) x^(-1+n)°n >ssd)88(x3502x2+7) > clear; syms x g:g=(x3-5)(2x2+7) > compose(diff(g x),0) ans > clear; syms x y g:g=(x3 y-5*y)(2*x2+7) 3*x^2(2*x^2+7)4*(X^~3-5)/(2*x~2+7)^2*x > subs(g xy, 1) ans 0.5309 Ex7-3
Key to MATLAB Exercise 7 School of Mathematical Sciences Xiamen University http://gdjpkc.xmu.edu.cn Key to Ex73 5) >> clear; syms x; y5=(tan(x)^(tan(x))); >> limit(y5,x,pi/4,’right’) ans = 1 6) >> clear; syms x; y=tan(x/2); >> limit(y,x,pi,'left') ans = Inf 5. 1) >> clear; syms x n h; y=((x+h)^nx^n)/h; >> z=limit(y,h,0) z = x^n/x*n >> simplify(z)) ans = x^(1+n)*n 2) >> clear; syms x n ; y= x^n; >> diff(y, x) ans = x^n/x*n >> simplify(diff(y,x)) ans = x^(1+n)*n 6. 1) >> clear; syms x g; g=(x^35)/(2*x^2+7); >> subs(diff(g,x),0) Or >> clear; syms x g; g=(x^35)/(2*x^2+7); >> compose(diff(g,x),0) ans = 0 2) >> clear; syms x y g; g=(x^3*y5*y)/(2*x^2+7); >> g_xy=diff(diff(g,x),y) g_xy = 3*x^2/(2*x^2+7)4*(x^35)/(2*x^2+7)^2*x >> subs(g_xy, 1) ans = 0.5309 Or
Key to mAtlaB Exercise 7 School of Mathematical Sciences Xiamen University h http:/edjpkc.xmu.ed >>clear; syms x y,g(x3 y-5* y)(2 x2+7);g xy=diff(difi(.x),y) compose(g xy, 1) 3/81 >>clear; syms gg=(x3*y-5*y)(2x2+7) >>gy=diff(g,y) gy- (x^3-5)(2*x^2+7) > subs(g y, [x,[1 2D) 4/9 >> clear; syms x f, fsin(x)*sin(2*x)*sin(3*x); > diff(f,5 1696cos(x)*sin(2*x)*sin(3*x)+2192*sin(x)*cos(2*x)*sin(3*)+2208*sin(x)*sin(2*x)*cos(3 x)-1680*cos(x)*cos(2*x)*cos(3*) 7 >>A=[15,8-2,6,3]B=(-1)*difA) >>A=[1,5,8-2,6,3];C= difI(A2 8. >>clear; syms x y; y=1/(x+1); >> int(y) > clear; syms y; y=1/(x+1); nt(y0,1) log(2) > clear; syms xt y, y=1/(x+l) > int(y, 0, t) ans logit+ Ex7-4
Key to MATLAB Exercise 7 School of Mathematical Sciences Xiamen University http://gdjpkc.xmu.edu.cn Key to Ex74 >> clear; syms x y g; g=(x^3*y5*y)/(2*x^2+7); g_xy=diff(diff(g,x),y) >> compose(g_xy,1) ans = 43/81 3) >> clear; syms x y g; g=(x^3*y5*y)/(2*x^2+7); >> g_y=diff(g,y) g_y = (x^35)/(2*x^2+7) >> subs(g_y, [x y], [1 2]) ans = 4/9 4) >> clear; syms x f; f=sin(x)*sin(2*x)*sin(3*x); >> diff(f,5) ans = 1696*cos(x)*sin(2*x)*sin(3*x)+2192*sin(x)*cos(2*x)*sin(3*x)+2208*sin(x)*sin(2*x)*cos(3 *x)1680*cos(x)*cos(2*x)*cos(3*x) 7. 1) >> A=[1,5,8,2,6,3]; B=(1)*diff(A) B = 4 3 10 8 3 2) >> A=[1,5,8,2,6,3]; C=diff(A,2) C = 1 13 18 11 8. 1) >> clear; syms x y; y=1/(x+1); >> int(y) ans = log(x+1) 2) >> clear; syms x y; y=1/(x+1); >> int(y,0,1) ans = log(2) 3) >> clear; syms x t y; y=1/(x+1); >> int(y,0,t) ans = log(t+1) 4)
Key to MATLAB Exercise 7 School of Mathematical Sciences Xiamen Univer http:/edjpkc.xmu.ed > clear; syms x y f, fsin(y)/(x 2*y+1); > int(f, x, -inf, inf ans pi*sin(y/y(1/2) > clear; syms x y f; fsin(y)/(x2 y+1) >>int(int(f, x, -inf, inf), -inf, inf) ans > clear; syms x f, fx2+ >>f int diff=int(diff(f)) f int diffe >>f diff int=diff(int(f)) f diff int= x^2+1 diff(int(f)) is not equal to int(difi(f)), the difference between them is the constant item C >> clear > simplify(symsum(k 3, 1,n)) 1/4*n^4+1/2*n^3+1/4*n^2 > clear; syms k; >> symsum(1/(k^2-1),1,nf) m(1/(k2-1)k=1…Int) > symsum(1/(k 2-1), 2, inf) ans > clear; syms kx f; fk xk; > symsum(f, k, 1, inf) x*(x+1)/(x-1)~3 > clear; syms x f, fexp(2x) > taylor(f, 15) ans Ex7-5
Key to MATLAB Exercise 7 School of Mathematical Sciences Xiamen University http://gdjpkc.xmu.edu.cn Key to Ex75 >> clear; syms x y f; f=sin(y)/(x^2*y+1); >> int(f,x,inf,inf) ans = pi*sin(y)/y^(1/2) 5) >> clear; syms x y f; f=sin(y)/(x^2*y+1); >> int(int(f,x,inf,inf),inf,inf) ans = 0 9. >> clear; syms x f; f=x^2+1; >> f_int_diff=int(diff(f)) f _int_diff= x^2 >> f_diff_int=diff(int(f)) f_diff_int = x^2+1 diff(int(f)) is not equal to int(diff(f)), the difference between them is the constant item C. 10. 1) >> clear; syms k n; >> simplify(symsum(k^3,1,n)) ans = 1/4*n^4+1/2*n^3+1/4*n^2 2) >> clear; syms k; >> symsum(1/(k^21),1,inf) ans = sum(1/(k^21),k = 1 .. Inf) 3) >> clear; syms k; >> symsum(1/(k^21),2,inf) ans = 3/4 4) >> clear; syms k x f; f=k^2*x^k; >> symsum(f,k,1,inf) ans = x*(x+1)/(x1)^3 11. 1) >> clear; syms x f; f=exp(2*x); >> taylor(f,15) ans =