KeytoMatlabexErcise7SchoolofMathematicalSciencesXiamenUniversityhttp:/gdjpkc.xmu.edu.cn 1+2*x+2*x^2+4/3*x^3+2/3*x^4+4/15*x^5+445*x^6+8/315*x^7+2/315*x^8+4/2835*x^9+4/14 175*x^10+8/155925*x^11+4/467775*x^12+8/6081075*X^13+8/42567525*x^14 >> clear; syms x f, f-exp(2*x); exp(-2)2*exp(-2)(x+1)+2exp(-2)°(x+1)2+4/3exp(-2)(x+1)^3+2/3°exp(-2)*(x+1)^4+4/ 15*exp(-2)*(x+1)^+4/45*exp(-2)*(x+1)^6+8/315*eXp(-2)(x+1)^7+2/315*exp(-2)°(x+1)^8 3) > clear; syms x y f; fexp(2*y > taylor(f, 5, x) ans 1+2*x*y+2*y^2*x^2+4/3*y3*x3+2/3*y4*x4 > clear; format short e, syms a x; fcos(x)+2*x, f int=int(f) >>b=a+10*pi, a+5 pi, a+pi, a+ 1/2*pi, a+1/16*pi, a+ 1/1024 pi]: >>fork=1:6 y(kint(f,a, b(k)); y app(k =(subs(f int, b(k)-subs(f int, a)*(b(k)-a) >>y, y app -2*sin(a)+10*a*pi+25pi^2, 2*sin(a)+2°a*p+pi^2 cos(a)+a*pi+1/4*pi"2-sin(a) sin(a+l/6°p1)+l/8°a*pi+1/256pi^2-sina) sin(a+1/l024°p)+1/512*api+1/048576*p^2-sin(a) 10°(a+10*p)2-a^2)* a+5*p)^2-a^2)pi, (-2*sin(a)+(a+pi)^2-a2)*pl, l/2*(cos(a)+(a+1/2°pi)^2-sin(a)a^2)°pi 1/16*(sin(a+1/16*pi)+(a+ 1/16 *pir2-sin(a)-ar2)*pi, l/1024(sin(a+1/1024*p)+(a+1/l024p)y2-sn(a)a^2)°pl >>y 0=subs(y, 0); y app 0=subs(y app, 0); error y=y o-y app 0 -3.0019e+004-3.6290e+0032.1137e+001-1.9792e+0001.8777e-0013.0679e-003 (a+ Conclusion While b closes to a 2(b-a)approaches >>clear; format long e; syms x xi; f1/(x+1)2: >> f int=int(f, 0, 1); Xi subs( inverse(f), f int)Key to MATLAB Exercise 7 School of Mathematical Sciences Xiamen University http://gdjpkc.xmu.edu.cn Key to Ex76 1+2*x+2*x^2+4/3*x^3+2/3*x^4+4/15*x^5+4/45*x^6+8/315*x^7+2/315*x^8+4/2835*x^9+4/14 175*x^10+8/155925*x^11+4/467775*x^12+8/6081075*x^13+8/42567525*x^14 2) >> clear; syms x f; f=exp(2*x); >> taylor(f,9,1) ans = exp(2)+2*exp(2)*(x+1)+2*exp(2)*(x+1)^2+4/3*exp(2)*(x+1)^3+2/3*exp(2)*(x+1)^4+4/ 15*exp(2)*(x+1)^5+4/45*exp(2)*(x+1)^6+8/315*exp(2)*(x+1)^7+2/315*exp(2)*(x+1)^8 3) >> clear; syms x y f; f=exp(2*x*y); >> taylor(f,5,x) ans = 1+2*x*y+2*y^2*x^2+4/3*y^3*x^3+2/3*y^4*x^4 12. >> clear; format short e; syms a x; f=cos(x)+2*x; f_int=int(f); >> b=[a+10*pi, a+5*pi, a+pi, a+1/2*pi, a+1/16*pi, a+1/1024*pi]; >> for k=1:6 y(k)=int(f,a,b(k)); y_app(k)=(subs(f_int, b(k))subs(f_int, a))*(b(k)a); end >> y, y_app y = [ 20*a*pi+100*pi^2, 2*sin(a)+10*a*pi+25*pi^2, 2*sin(a)+2*a*pi+pi^2, cos(a)+a*pi+1/4*pi^2sin(a), sin(a+1/16*pi)+1/8*a*pi+1/256*pi^2sin(a), sin(a+1/1024*pi)+1/512*a*pi+1/1048576*pi^2sin(a)] y_app = [ 10*((a+10*pi)^2a^2)*pi, 5*(2*sin(a)+(a+5*pi)^2a^2)*pi, (2*sin(a)+(a+pi)^2a^2)*pi, 1/2*(cos(a)+(a+1/2*pi)^2sin(a)a^2)*pi, 1/16*(sin(a+1/16*pi)+(a+1/16*pi)^2sin(a)a^2)*pi, 1/1024*(sin(a+1/1024*pi)+(a+1/1024*pi)^2sin(a)a^2)*pi] >> y_0=subs(y, 0); y_app_0=subs(y_app, 0); error_y=y_0y_app_0 error_y = 3.0019e+004 3.6290e+003 2.1137e+001 1.9792e+000 1.8777e001 3.0679e003 Conclusion: While b closes to a, ( ) sin 2 ( ) 2 2 a b a b b a Ê Ê + ˆ + ˆ Á ˜ + - Á ˜ Ë Ë ¯ ¯ approaches to (cos 2 ) b a x + x dx Ú . 13. >> clear; format long e; syms x xi; f=1/(x+1)^2; >> f_int=int(f, 0, 1); xi= subs(finverse(f),f_int)