1、南邮数学实验答案第一次练习题1、求的所有根。x=-5:0.01:5;y=exp(x)-3*x.2;plot(x,y);grid on fsolve(exp(x)-3*x.2,-1)Equation solved.fsolve completed because the vector of function values is near zeroas measured by the default value of the function tolerance, andthe problem appears regular as measured by the gradient.ans = -0
2、.4590 fsolve(exp(x)-3*x.2,1)Equation solved.fsolve completed because the vector of function values is near zeroas measured by the default value of the function tolerance, andthe problem appears regular as measured by the gradient.ans = 0.9100 fsolve(exp(x)-3*x.2,4)Equation solved.fsolve completed be
3、cause the vector of function values is near zeroas measured by the default value of the function tolerance, andthe problem appears regular as measured by the gradient.ans =3.73312、求下列方程的根。1) 2) 3) 1) p=1,0,0,0,5,1;r=roots(p)r = 1.1045 + 1.0598i 1.1045 - 1.0598i -1.0045 + 1.0609i -1.0045 - 1.0609i -0
4、.1999 2) x=-10:0.01:10;y=x.*sin(x)-1/2;plot(x,y);grid on fsolve(x.*sin(x)-1/2,-6)Equation solved.fsolve completed because the vector of function values is near zeroas measured by the default value of the function tolerance, andthe problem appears regular as measured by the gradient.ans = -6.3619 fso
5、lve(x.*sin(x)-1/2,-4)Equation solved.fsolve completed because the vector of function values is near zeroas measured by the default value of the function tolerance, andthe problem appears regular as measured by the gradient.ans = -2.9726 fsolve(x.*sin(x)-1/2,2)Equation solved.fsolve completed because
6、 the vector of function values is near zeroas measured by the default value of the function tolerance, andthe problem appears regular as measured by the gradient.ans =0.74083) x=-3:0.01:3;y=sin(x).*cos(x)-x.2;plot(x,y);grid on fsolve(sin(x).*cos(x)-x.2,-1)Equation solved.fsolve completed because the
7、 vector of function values is near zeroas measured by the default value of the function tolerance, andthe problem appears regular as measured by the gradient.ans = -6.8434e-010 fsolve(sin(x).*cos(x)-x.2,1)Equation solved.fsolve completed because the vector of function values is near zeroas measured
8、by the default value of the function tolerance, andthe problem appears regular as measured by the gradient.ans =0.70223、求解下列各题: 1) 2) 3) 4)5) 6) 1) syms x limit(x-sin(x)/x3) ans = 1/62) diff(exp(x)*cos(x),10) ans = -32*exp(x)*sin(x)3) int(exp(x2),x,0,1/2) ans = (pi(1/2)*erfi(1/2)/2 vpa(ans,17) ans =
9、 0.544987104183622224) int(x4/(25+4*x2),x) ans = (125*atan(2*x)/5)/32 - (25*x)/16 + x3/125) taylor(sqrt(1+x),9,x,0) ans = - (429*x8)/32768 + (33*x7)/2048 - (21*x6)/1024 + (7*x5)/256 - (5*x4)/128 + x3/16 - x2/8 + x/2 + 16) diff(exp(sin(1/x),3) ans = (cos(1/x)*exp(sin(1/x)/x6 - (6*cos(1/x)*exp(sin(1/x
10、)/x4 + (6*sin(1/x)*exp(sin(1/x)/x5 - (6*cos(1/x)2*exp(sin(1/x)/x5 - (cos(1/x)3*exp(sin(1/x)/x6 + (3*cos(1/x)*sin(1/x)*exp(sin(1/x)/x6 subs(ans,2)ans = -0.58264、求矩阵 的逆矩阵及特征值和特征向量。 A=-2,1,1;0,2,0;-4,1,3; inv(A)ans = -1.5000 0.5000 0.5000 0 0.5000 0 -2.0000 0.5000 1.0000 eig(A)ans = -1 2 2 P,D=eig(A)P
11、= -0.7071 -0.2425 0.3015 0 0 0.9045 -0.7071 -0.9701 0.3015D = -1 0 0 0 2 0 0 0 25、已知分别在下列条件下画出的图形:、(1) x=-10:0.01:10; y1=1/sqrt(2*pi).*exp(-x.2/2); y2=1/sqrt(2*pi).*exp(-(x+1).2/2); y3=1/sqrt(2*pi).*exp(-(x-1).2/2); plot(x,y1,x,y2,x,y3)(2) x=-10:0.01:10; y1=1/sqrt(2*pi).*exp(-x.2/2); y2=1/(sqrt(2*pi
12、)*2).*exp(-x.2/(2*22); y3=1/(sqrt(2*pi)*4).*exp(-x.2/(2*42); plot(x,y1,x,y2,x,y3)6、画 下列函数的图形:(1) (2) (3)(1) ezmesh(u*sin(t),u*cos(t),t/4,0,20,0,2);axis equal;(2) ezmesh(x,y,sin(x*y),0,3,0,3);axis equal;(3) ezmesh(sin(t)*(3+cos(u),cos(t)*(3+cos(u),sin(u),0,2*pi,0,2*pi);axis equal;第二次练习题1、 设,数列是否收敛?若收
13、敛,其值为多少?精确到6位有效数字。 f=inline(x+7/x)/2); x0=3; for i=1:20x0=f(x0);fprintf(%g,%gn,i,x0);end1,2.666672,2.645833,2.645754,2.645755,2.645756,2.645757,2.645758,2.645759,2.6457510,2.6457511,2.6457512,2.6457513,2.6457514,2.6457515,2.6457516,2.6457517,2.6457518,2.6457519,2.6457520,2.645752、设 是否收敛?若收敛,其值为多少?精确
14、到17位有效数字, f=inline(1/n8); x1=0;for i=1:150x1=x1+f(i);fprintf(%g,%1.16fn,i,x1);end1,1.00000000000000002,1.00390625000000003,1.00405866579027594,1.00407392457933845,1.00407648457933846,1.00407707995351927,1.00407725342004488,1.00407731302468969,1.004077336255262610,1.004077346255262611,1.0040773509203
15、36512,1.004077353246016813,1.004077354471911514,1.004077355149515015,1.004077355539699316,1.004077355772530017,1.004077355915883518,1.004077356006628119,1.004077356065508520,1.004077356104571121,1.004077356131010122,1.004077356149233123,1.004077356162002724,1.004077356171087425,1.004077356177641026,
16、1.004077356182429727,1.004077356185970428,1.004077356188617429,1.004077356190616430,1.004077356192140631,1.004077356193313032,1.004077356194222433,1.004077356194933434,1.004077356195493435,1.004077356195937536,1.004077356196291937,1.004077356196576638,1.004077356196806639,1.004077356196993340,1.0040
17、77356197145941,1.004077356197271142,1.004077356197374443,1.004077356197459944,1.004077356197531145,1.004077356197590646,1.004077356197640647,1.004077356197682648,1.004077356197718149,1.004077356197748350,1.004077356197773851,1.004077356197795652,1.004077356197814253,1.004077356197830254,1.0040773561
18、97844055,1.004077356197856056,1.004077356197866457,1.004077356197875358,1.004077356197883159,1.004077356197890060,1.004077356197896061,1.004077356197901162,1.004077356197905763,1.004077356197909764,1.004077356197913365,1.004077356197916466,1.004077356197919367,1.004077356197921768,1.0040773561979239
19、69,1.004077356197925970,1.004077356197927771,1.004077356197929372,1.004077356197930673,1.004077356197931974,1.004077356197933075,1.004077356197933976,1.004077356197934877,1.004077356197935778,1.004077356197936479,1.004077356197937080,1.004077356197937781,1.004077356197938182,1.004077356197938683,1.0
20、04077356197939084,1.004077356197939585,1.004077356197939986,1.004077356197940487,1.004077356197940688,1.004077356197940889,1.004077356197941090,1.004077356197941391,1.004077356197941592,1.004077356197941793,1.004077356197941994,1.004077356197942195,1.004077356197942496,1.004077356197942697,1.0040773
21、56197942898,1.004077356197943099,1.0040773561979430100,1.0040773561979430101,1.0040773561979430102,1.0040773561979430103,1.0040773561979430104,1.0040773561979430105,1.0040773561979430106,1.0040773561979430107,1.0040773561979430108,1.0040773561979430109,1.0040773561979430110,1.0040773561979430111,1.0
22、040773561979430112,1.0040773561979430113,1.0040773561979430114,1.0040773561979430115,1.0040773561979430116,1.0040773561979430117,1.0040773561979430118,1.0040773561979430119,1.0040773561979430120,1.0040773561979430121,1.0040773561979430122,1.0040773561979430123,1.0040773561979430124,1.004077356197943
23、0125,1.0040773561979430126,1.0040773561979430127,1.0040773561979430128,1.0040773561979430129,1.0040773561979430130,1.0040773561979430131,1.0040773561979430132,1.0040773561979430133,1.0040773561979430134,1.0040773561979430135,1.0040773561979430136,1.0040773561979430137,1.0040773561979430138,1.0040773
24、561979430139,1.0040773561979430140,1.0040773561979430141,1.0040773561979430142,1.0040773561979430143,1.0040773561979430144,1.0040773561979430145,1.0040773561979430146,1.0040773561979430147,1.0040773561979430148,1.0040773561979430149,1.0040773561979430150,1.00407735619794303、编程判断函数f(x)= 的迭代序列是否收敛。 f=
25、inline(x-1)/(x+1); x0=2; for i=1:20x0=f(x0);fprintf(%g,%gn,i,x0);end1,0.3333332,-0.53,-34,25,0.3333336,-0.57,-38,29,0.33333310,-0.511,-312,213,0.33333314,-0.515,-316,217,0.33333318,-0.519,-320,24、先分别求出线性函数= , 的不动点,再编程判断它们的迭代序列是否收敛。 solve(x-1)/(x+3)-x) ans = -1 solve(-x+15)/(x+1)-x) ans = 3 -5待定5、能否找
26、到一个分式线性函数,使它产生的迭代序列收敛到给定的数,用这种方法近似计算。 f=inline(2+x)/(x+1); x0=2; for i=1:20x0=f(x0);fprintf(%g,%fn,i,x0);end1,1.3333332,1.4285713,1.4117654,1.4146345,1.4141416,1.4142267,1.4142118,1.4142149,1.41421310,1.41421411,1.41421412,1.41421413,1.41421414,1.41421415,1.41421416,1.41421417,1.41421418,1.41421419,
27、1.41421420,1.4142146、函数f(x)=ax(1-x)(0x1)称为Logistic映射,试从“蜘蛛网”图观察它的取初值为0.5产生的迭代序列的收敛性,将观察记录填入表中,若出现循环,请指出它的周期。3.33.53.563.5683.63.84序列收敛情况 f=inline(3.3*x*(1-x);x=;y=;x(1)=0.5;y(1)=0;x(2)=x(1);y(2)=f(x(1);for i=1:100x(1+2*i)=y(2*i);x(2+2*i)=x(1+2*i);y(1+2*i)=x(1+2*i);y(2+2*i)=f(x(2+2*i);endplot(x,y,r);
28、hold on;syms x;ezplot(x,0,1);ezplot(f(x),0,1);axis(0,1,0,1);hold off f=inline(3.5*x*(1-x);x=;y=;x(1)=0.5;y(1)=0;x(2)=x(1);y(2)=f(x(1);for i=1:100x(1+2*i)=y(2*i);x(2+2*i)=x(1+2*i);y(1+2*i)=x(1+2*i);y(2+2*i)=f(x(2+2*i);endplot(x,y,r);hold on;syms x;ezplot(x,0,1);ezplot(f(x),0,1);axis(0,1,0,1);hold off f=inline(3.56*x*(1-x);x=;y=
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1