南邮数学实验答案.docx

上传人:b****5 文档编号:4572807 上传时间:2022-12-06 格式:DOCX 页数:33 大小:1.76MB
下载 相关 举报
南邮数学实验答案.docx_第1页
第1页 / 共33页
南邮数学实验答案.docx_第2页
第2页 / 共33页
南邮数学实验答案.docx_第3页
第3页 / 共33页
南邮数学实验答案.docx_第4页
第4页 / 共33页
南邮数学实验答案.docx_第5页
第5页 / 共33页
点击查看更多>>
下载资源
资源描述

南邮数学实验答案.docx

《南邮数学实验答案.docx》由会员分享,可在线阅读,更多相关《南邮数学实验答案.docx(33页珍藏版)》请在冰豆网上搜索。

南邮数学实验答案.docx

南邮数学实验答案

第一次练习题

1、求

的所有根。

>>x=-5:

0.01:

5;y=exp(x)-3*x.^2;plot(x,y);gridon

>>fsolve('exp(x)-3*x.^2',-1)

Equationsolved.

fsolvecompletedbecausethevectoroffunctionvaluesisnearzero

asmeasuredbythedefaultvalueofthefunctiontolerance,and

theproblemappearsregularasmeasuredbythegradient.

 

ans=

-0.4590

>>fsolve('exp(x)-3*x.^2',1)

Equationsolved.

fsolvecompletedbecausethevectoroffunctionvaluesisnearzero

asmeasuredbythedefaultvalueofthefunctiontolerance,and

theproblemappearsregularasmeasuredbythegradient.

 

ans=

0.9100

>>fsolve('exp(x)-3*x.^2',4)

Equationsolved.

fsolvecompletedbecausethevectoroffunctionvaluesisnearzero

asmeasuredbythedefaultvalueofthefunctiontolerance,and

theproblemappearsregularasmeasuredbythegradient.

 

ans=

3.7331

2、求下列方程的根。

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.1999

2)>>x=-10:

0.01:

10;y=x.*sin(x)-1/2;plot(x,y);gridon

>>fsolve('x.*sin(x)-1/2',-6)

Equationsolved.

fsolvecompletedbecausethevectoroffunctionvaluesisnearzero

asmeasuredbythedefaultvalueofthefunctiontolerance,and

theproblemappearsregularasmeasuredbythegradient.

 

ans=

-6.3619

>>fsolve('x.*sin(x)-1/2',-4)

Equationsolved.

fsolvecompletedbecausethevectoroffunctionvaluesisnearzero

asmeasuredbythedefaultvalueofthefunctiontolerance,and

theproblemappearsregularasmeasuredbythegradient.

 

ans=

-2.9726

>>fsolve('x.*sin(x)-1/2',2)

Equationsolved.

fsolvecompletedbecausethevectoroffunctionvaluesisnearzero

asmeasuredbythedefaultvalueofthefunctiontolerance,and

theproblemappearsregularasmeasuredbythegradient.

 

ans=

0.7408

3)>>x=-3:

0.01:

3;y=sin(x).*cos(x)-x.^2;plot(x,y);gridon

>>fsolve('sin(x).*cos(x)-x.^2',-1)

Equationsolved.

fsolvecompletedbecausethevectoroffunctionvaluesisnearzero

asmeasuredbythedefaultvalueofthefunctiontolerance,and

theproblemappearsregularasmeasuredbythegradient.

 

ans=

-6.8434e-010

>>fsolve('sin(x).*cos(x)-x.^2',1)

Equationsolved.

fsolvecompletedbecausethevectoroffunctionvaluesisnearzero

asmeasuredbythedefaultvalueofthefunctiontolerance,and

theproblemappearsregularasmeasuredbythegradient.

 

ans=

0.7022

3、求解下列各题:

1)

2)

3)

4)

5)

6)

1)>>symsx

>>limit((x-sin(x))/x^3)

ans=

1/6

2)>>diff(exp(x)*cos(x),10)

ans=

-32*exp(x)*sin(x)

3)>>int(exp(x^2),x,0,1/2)

ans=

(pi^(1/2)*erfi(1/2))/2

>>vpa(ans,17)

ans=

0.54498710418362222

4)>>int(x^4/(25+4*x^2),x)

ans=

(125*atan((2*x)/5))/32-(25*x)/16+x^3/12

5)>>taylor(sqrt(1+x),9,x,0)

ans=

-(429*x^8)/32768+(33*x^7)/2048-(21*x^6)/1024+(7*x^5)/256-(5*x^4)/128+x^3/16-x^2/8+x/2+1

6)>>diff(exp(sin(1/x)),3)

ans=

(cos(1/x)*exp(sin(1/x)))/x^6-(6*cos(1/x)*exp(sin(1/x)))/x^4+(6*sin(1/x)*exp(sin(1/x)))/x^5-(6*cos(1/x)^2*exp(sin(1/x)))/x^5-(cos(1/x)^3*exp(sin(1/x)))/x^6+(3*cos(1/x)*sin(1/x)*exp(sin(1/x)))/x^6

>>subs(ans,2)

ans=

-0.5826

4、求矩阵

的逆矩阵

及特征值和特征向量。

>>A=[-2,1,1;0,2,0;-4,1,3];

>>inv(A)

ans=

-1.50000.50000.5000

00.50000

-2.00000.50001.0000

>>eig(A)

ans=

-1

2

2

>>[P,D]=eig(A)

P=

-0.7071-0.24250.3015

000.9045

-0.7071-0.97010.3015

 

D=

-100

020

002

5、已知

分别在下列条件下画出

的图形:

(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)*2).*exp(-x.^2/(2*2^2));

>>y3=1/(sqrt(2*pi)*4).*exp(-x.^2/(2*4^2));

>>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]);axisequal;

(2)>>ezmesh('x','y','sin(x*y)',[0,3,0,3]);axisequal;

(3)>>ezmesh('sin(t)*(3+cos(u))','cos(t)*(3+cos(u))','sin(u)',[0,2*pi,0,2*pi]);axisequal;

第二次练习题

1、设

,数列

是否收敛?

若收敛,其值为多少?

精确到6位有效数字。

>>f=inline('(x+7/x)/2');

>>x0=3;

>>fori=1:

20

x0=f(x0);

fprintf('%g,%g\n',i,x0);

end

1,2.66667

2,2.64583

3,2.64575

4,2.64575

5,2.64575

6,2.64575

7,2.64575

8,2.64575

9,2.64575

10,2.64575

11,2.64575

12,2.64575

13,2.64575

14,2.64575

15,2.64575

16,2.64575

17,2.64575

18,2.64575

19,2.64575

20,2.64575

2、设

是否收敛?

若收敛,其值为多少?

精确到17位有效数字,

>>f=inline('1/n^8');

>>x1=0;

>>fori=1:

150

x1=x1+f(i);

fprintf('%g,%1.16f\n',i,x1);

end

1,1.0000000000000000

2,1.0039062500000000

3,1.0040586657902759

4,1.0040739245793384

5,1.0040764845793384

6,1.0040770799535192

7,1.0040772534200448

8,1.0040773130246896

9,1.0040773362552626

10,1.0040773462552626

11,1.0040773509203365

12,1.0040773532460168

13,1.0040773544719115

14,1.0040773551495150

15,1.0040773555396993

16,1.0040773557725300

17,1.0040773559158835

18,1.0040773560066281

19,1.0040773560655085

20,1.0040773561045711

21,1.0040773561310101

22,1.0040773561492331

23,1.0040773561620027

24,1.0040773561710874

25,1.0040773561776410

26,1.0040773561824297

27,1.0040773561859704

28,1.0040773561886174

29,1.0040773561906164

30,1.0040773561921406

31,1.0040773561933130

32,1.0040773561942224

33,1.0040773561949334

34,1.0040773561954934

35,1.0040773561959375

36,1.0040773561962919

37,1.0040773561965766

38,1.0040773561968066

39,1.0040773561969933

40,1.0040773561971459

41,1.0040773561972711

42,1.0040773561973744

43,1.0040773561974599

44,1.0040773561975311

45,1.0040773561975906

46,1.0040773561976406

47,1.0040773561976826

48,1.0040773561977181

49,1.0040773561977483

50,1.0040773561977738

51,1.0040773561977956

52,1.0040773561978142

53,1.0040773561978302

54,1.0040773561978440

55,1.0040773561978560

56,1.0040773561978664

57,1.0040773561978753

58,1.0040773561978831

59,1.0040773561978900

60,1.0040773561978960

61,1.0040773561979011

62,1.0040773561979057

63,1.0040773561979097

64,1.0040773561979133

65,1.0040773561979164

66,1.0040773561979193

67,1.0040773561979217

68,1.0040773561979239

69,1.0040773561979259

70,1.0040773561979277

71,1.0040773561979293

72,1.0040773561979306

73,1.0040773561979319

74,1.0040773561979330

75,1.0040773561979339

76,1.0040773561979348

77,1.0040773561979357

78,1.0040773561979364

79,1.0040773561979370

80,1.0040773561979377

81,1.0040773561979381

82,1.0040773561979386

83,1.0040773561979390

84,1.0040773561979395

85,1.0040773561979399

86,1.0040773561979404

87,1.0040773561979406

88,1.0040773561979408

89,1.0040773561979410

90,1.0040773561979413

91,1.0040773561979415

92,1.0040773561979417

93,1.0040773561979419

94,1.0040773561979421

95,1.0040773561979424

96,1.0040773561979426

97,1.0040773561979428

98,1.0040773561979430

99,1.0040773561979430

100,1.0040773561979430

101,1.0040773561979430

102,1.0040773561979430

103,1.0040773561979430

104,1.0040773561979430

105,1.0040773561979430

106,1.0040773561979430

107,1.0040773561979430

108,1.0040773561979430

109,1.0040773561979430

110,1.0040773561979430

111,1.0040773561979430

112,1.0040773561979430

113,1.0040773561979430

114,1.0040773561979430

115,1.0040773561979430

116,1.0040773561979430

117,1.0040773561979430

118,1.0040773561979430

119,1.0040773561979430

120,1.0040773561979430

121,1.0040773561979430

122,1.0040773561979430

123,1.0040773561979430

124,1.0040773561979430

125,1.0040773561979430

126,1.0040773561979430

127,1.0040773561979430

128,1.0040773561979430

129,1.0040773561979430

130,1.0040773561979430

131,1.0040773561979430

132,1.0040773561979430

133,1.0040773561979430

134,1.0040773561979430

135,1.0040773561979430

136,1.0040773561979430

137,1.0040773561979430

138,1.0040773561979430

139,1.0040773561979430

140,1.0040773561979430

141,1.0040773561979430

142,1.0040773561979430

143,1.0040773561979430

144,1.0040773561979430

145,1.0040773561979430

146,1.0040773561979430

147,1.0040773561979430

148,1.0040773561979430

149,1.0040773561979430

150,1.0040773561979430

3、编程判断函数f(x)=

的迭代序列是否收敛。

>>f=inline('(x-1)/(x+1)');

>>x0=2;

>>fori=1:

20

x0=f(x0);

fprintf('%g,%g\n',i,x0);

end

1,0.333333

2,-0.5

3,-3

4,2

5,0.333333

6,-0.5

7,-3

8,2

9,0.333333

10,-0.5

11,-3

12,2

13,0.333333

14,-0.5

15,-3

16,2

17,0.333333

18,-0.5

19,-3

20,2

4、先分别求出线性函数

=

的不动点,再编程判断它们的迭代序列是否收敛。

>>solve('(x-1)/(x+3)-x')

ans=

-1

>>solve('(-x+15)/(x+1)-x')

ans=

3

-5

待定

5、能否找到一个分式线性函数

使它产生的迭代序列收敛到给定的数,用这种方法近似计算

>>f=inline('(2+x)/(x+1)');

>>x0=2;

>>fori=1:

20

x0=f(x0);

fprintf('%g,%f\n',i,x0);

end

1,1.333333

2,1.428571

3,1.411765

4,1.414634

5,1.414141

6,1.414226

7,1.414211

8,1.414214

9,1.414213

10,1.414214

11,1.414214

12,1.414214

13,1.414214

14,1.414214

15,1.414214

16,1.414214

17,1.414214

18,1.414214

19,1.414214

20,1.414214

6、函数f(x)=ax(1-x)(0≤x≤1)称为Logistic映射,试从“蜘蛛网”图观察它的取初值为

0.5产生的迭代序列的收敛性,将观察记录填入表中,若出现循环,请指出它的周期。

α

3.3

3.5

3.56

3.568

3.6

3.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));

fori=1:

100

x(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));

end

plot(x,y,'r');

holdon;

symsx;

ezplot(x,[0,1]);

ezplot(f(x),[0,1]);

axis([0,1,0,1]);

holdoff

>>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));

fori=1:

100

x(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));

end

plot(x,y,'r');

holdon;

symsx;

ezplot(x,[0,1]);

ezplot(f(x),[0,1]);

axis([0,1,0,1]);

holdoff

>>f=inline('3.56*x*(1-x)');

x=[];

y=

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高中教育 > 高中教育

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1