版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、數四數值分析 期中考試題與參考解答科目代碼:BMA42401 11/07/20081. 20% For , (a) Compute the values of f(x) at x=10-2, 10-4, 10-6, 10-8, 10-10(b) Analytically find the limit . (c) Do you think the values in (a) all are correct ? If your answer is 'no' explain what causes the problem and how can you do an improveme
2、nt ? 解:(a) x= 10-2 10-4 10-6 10-8 10-10 ; y= (x-sin(x)./(x.3 ) y = 0.1667 0.1667 0.1667 0 0 (b) (c) No. The loss of accuracy is due to round-off error. The subtraction of nearly equal numbers ( as ) causes the loss of significant digits. By Taylor formula therefore, as x0, we define the function gx=
3、1/6-(x.2)/120+(x.4)/5040 gx = 0.1667 0.1667 0.1667 0.1667 0.1667 2. 25% Consider the equation ex = 3x on 1, 2 . (a) Show that there exists a unique solution in the interval 1,2 . (b) To find a bound for the number of iterations needed to achieve an approximation solution with accuracy 10-6 by the bi
4、section method . And generate the values of the iterations. (c) Using Aitkensmethod to improve the convergence in part (b). 解:(a) Let f(x)= ex - 3x , we obtain f(1)=-0.2817<0 and f(2)=1.3891>0 Hence, there exists a solution in1,2 . Since f '(x)= ex 3 , f(x) is increasing onln3, 2 and decre
5、asing on1,ln3 ln3 1.0986123, and f(1)= -0.2817. Therefore, the solution is unique. (b) a= 1; b=2; tor=10(-6) ; t=6*log2(10) t = 19.9316 Take n = 20 s='3*x-exp(x)' ; n=20; format longp=bisection1(s,a,b, n,tor) n c f(c) error 0 1.500000 0.01831093 0.5 1 1.750000 -0.5046027 0.25 2 1.625000 -0.2
6、03419 0.125 3 1.562500 -0.08323318 0.0625 4 1.531250 -0.03020315 0.03125 5 1.515625 -0.005390404 0.015625 6 1.507813 0.006598107 0.0078125 7 1.511719 0.0006384471 0.00390625 8 1.513672 -0.002367313 0.001953125 9 1.512695 -0.0008622684 0.0009765625 10 1.512207 -0.0001113698 0.0004882813 11 1.511963 0
7、.0002636738 0.0002441406 12 1.512085 7.618579e-005 0.0001220703 13 1.512146 -1.758357e-005 6.103516e-005 14 1.512115 2.930322e-005 3.051758e-005 15 1.512131 5.860353e-006 1.525879e-005 16 1.512138 -5.861477e-006 7.629395e-006 17 1.512135 -5.286926e-010 3.814697e-006 18 1.512133 2.92992e-006 1.907349
8、e-006 19 1.512134 1.464698e-006 9.536743e-007convergent or f(x) is almost 0p = Columns 1 through 4 1.500000000000000 1.750000000000000 1.625000000000000 1.562500000000000 Columns 5 through 8 Columns 9 through 12 Columns 13 through 16 Columns 17 through 20 (d) generate the new sequence : type deltasq
9、r.m function rs=deltasqr(p)%this function is generate the Aitken's delta squaren=length(p) ;for j=1:n-2 h=p(j+1)-p(j); k=p(j+2)-p(j+1); rs(j)=p(j)-(h2)/(k-h) ;end q=deltasqr(p) q = Columns 1 through 4 1.666666666666667 1.500000000000000 1.500000000000000 1.500000000000000 Columns 5 through 8 Col
10、umns 9 through 12 Columns 13 through 16 Columns 17 through 18 compare Matlab fzero('exp(x)-3*x',1 2)format short ans = 3. 25% For the equation x2 = 1+x on 0, 2 . (a) Show that there exists a unique solution in the interval 0,2 . (b) Find two functions g1(x) and g2(x) then use fixed-point ite
11、ration to find an approximation solution with accuracy 10-6 by g1(x) and g2(x) respectively. (c) Plot the graphs of g1(x) and y=x together and locate the points of iterations. 解:(a) Let f(x)= x2 - x- 1 , we obtain f(0)=-1<0 and f(2)=1>0 Hence, there exists a solution in0,2 . Since f '(x)=
12、2x- 1 , f(x) is increasing on0.5, 2 and decreasing on0,0.5 f(0.5)=-1.25 and f(0)=-1 . So the solution is unique. (b) Let g1(x)= , g2(x)= type fixpt.m function fixpt( s, a, n, tor)%fixed-point method%g=inline(s,'x') ;ga = feval(g,a); %evaluate g(a)fprintf('initial a= %10.6f g(a)= %0.7gnn&
13、#39;,a ,ga)%start iterationfprintf(' n x g(x)n')for j = 1: n fprintf('%3d %10.6f %0.7gn',j ,a ,ga) if abs(ga-a) < tor fprintf('nconvergencen') return end a=ga ;%generate next point ga = feval(g,a);end %for s='sqrt(x+1) ' ; a=0 ; % initial n=20; tor= 10(-6) ; fixpt(
14、s, a,n,tor) initial a= 0.000000 g(a)= 1 n x g(x) 1 0.000000 1 2 1.000000 1.414214 3 1.414214 1.553774 4 1.553774 1.598053 5 1.598053 1.611848 6 1.611848 1.616121 7 1.616121 1.617443 8 1.617443 1.617851 9 1.617851 1.617978 10 1.617978 1.618017 11 1.618017 1.618029 12 1.618029 1.618032 13 1.618032 1.6
15、18033 14 1.618033 1.618034convergence s='x2-x-1' newton(s,a,n,tor) initial a= 0.000000 f(a)= -1 n x f(x) 1 -1.000000 1 2 -0.666667 0.1111111 3 -0.619048 0.002267574 4 -0.618034 1.026516e-006 5 -0.618034 2.109424e-013convergence s='x2-x-1' a=1.2; newton(s,a,n,tor) initial a= 1.200000
16、f(a)= -0.76 n x f(x) 1 1.742857 0.2946939 2 1.624302 0.01405529 3 1.618051 3.907091e-005 4 1.618034 3.052978e-010 5 1.618034 0convergence ( c) t=0:01:2 ; gt=sqrt(t+1) ; plot(t,t,t,gt) 4. 25% Nevilles method is used to approximate f(0.4), giving the following table x0 = 0 P0 =1 x1 = 0.25 P1 =2 P01 =2
17、.6 x2 = 0.5 P2 =? P12 =? P012 =? x3 = 0.75 P3 =8 P23 =2.4 P123 =2.96 P0123 =3.016 (a) Determine P2 , P12 and P012 . (b) Use the data in the table to construct the Newtons divided-difference coefficients and find the approximation of f(0.4) by forward-difference formula . 解:(a) Similarly, 或執行m-file n
18、evl.m得下列結果path('d:numerical',path) n=4; t=0.4;x=0 0.25 0.5 0.75 ; y=1 2 4 8 ; rs= nevl(x,y,n,t) rs = 1.0000 0 0 0 2.0000 2.6000 0 0 4.0000 3.2000 3.0800 0 8.0000 2.4000 2.9600 3.0160 (b) 執行m-file coeff.m得Newton's divided-difference coefficients C=coeff(x,y,n) ;t = 0.4; for j =1:nc (j)= C(j, j) ; %take the main diagonal entries end val = evalnt(c, x, t, n) ;fprintf('The value of p(x) at t=%f is :%f',t,val) The value of p(x) at t=0.400000 is :3.016000 與上面Neville's P0123=3.016是一致的。5. 15% (a) A natural cubic spline S on 0,2 is defined by Find b, c, and d . (b) Plot th
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024至2030年耐温高效过滤器项目投资价值分析报告
- 2024至2030年真空角阀项目投资价值分析报告
- 2024至2030年物业指示标识项目投资价值分析报告
- 2024年市国民经济和社会发展计划执行情况的报告
- 2024至2030年机械传动产品项目投资价值分析报告
- 2024至2030年中国十二股编织绳行业投资前景及策略咨询研究报告
- 2024至2030年卡通储蓄罐项目投资价值分析报告
- 2024至2030年公安多媒体档案管理系统项目投资价值分析报告
- 2024年中国黄铜弯头市场调查研究报告
- 2024年道路交通反光标志牌项目可行性研究报告
- 2025届高三化学专题复习 硼及化合物复习
- 安徽省宿州市埇桥区教育集团2023-2024学年八上期中数学试题(解析版)
- 环境保护与可持续发展
- 水果预购合同模板
- 2024秋期国家开放大学专科《人力资源管理》一平台在线形考(形考任务一至四)试题及答案
- 工程项目管理目标及履约保证措施
- 《氢能源商用车动力总成硅胶管》(征求意见稿)
- 20以内的加法口算练习题4000题 290
- DB36-T 1964-2024 新型冠状病毒基因溯源技术规范
- 2024至2030年中国硼10碳化硼市场现状及未来发展趋势
- 上海链家买卖合同模板
评论
0/150
提交评论