数值分析作业答案.docx

上传人(卖家):最好的沉淀 文档编号:5717195 上传时间:2023-05-05 格式:DOCX 页数:28 大小:309.47KB
下载 相关 举报
数值分析作业答案.docx_第1页
第1页 / 共28页
数值分析作业答案.docx_第2页
第2页 / 共28页
数值分析作业答案.docx_第3页
第3页 / 共28页
数值分析作业答案.docx_第4页
第4页 / 共28页
数值分析作业答案.docx_第5页
第5页 / 共28页
点击查看更多>>
资源描述

1、第 2 章 插值法1、当 x=1,-1,2 时,f(x)=0,-3,4,求 f(x)的二次插值多项式。(1) 用单项式基底。(2) 用 Lagrange 插值基底。(3) 用 Newton 基底。证明三种方法得到的多项式是相同的。解:(1)用单项式基底精品文档设多项式为: P(x) = a0+ a x + a12x2 ,1xx200111所以: A = 1x1x2 = 1 -1 1 = -611xx222124f (x )0a = f (x )01f (x )x0x1xx20x21x2111x0x1xx20x2x20= - 341-1 21141111-1 211 = 14 = - 7- 63

2、42222211f (x0)x21x00x21010111- 93a = 1f (x )x21xx2 = 1 - 311 -1 1 = - 6 = 2111f (x211)x21x221x214421241xf (x )001xx211000111- 55a = 1x21f (x )1x11x2 = 1 -1 - 311 -1 1 = - 6 = 61xf (x )221xx2122241247所以 f(x)的二次插值多项式为: P(x) = -+335+xx226(2)用 Lagrange 插值基底l (x) =(x - x )(x - x12) = (x +1)(x - 2)0(x - x

3、 )(x - x )(1+1)(1- 2)0102l (x) =(x - x0)(x - x2) = (x -1)(x - 2)1(x1- x )(x01- x )(-1-1)(-1- 2)2(x - x )(x - x )(x -1)(x +1)l (x) = 01= 2(x2- x )(x02- x )(2 -1)(2 +1)1Lagrange 插值多项式为:精品文档L (x) = f (x )l (x) + f (x )l (x) + f (x )l(x)20 01 12 2537= 0 + (-3) 1 (x -1)(x - 2) + 4 1 (x -1)(x +1) 63=x2 +x

4、 -6237所以 f(x)的二次插值多项式为: L (x) = -+35+xx22326(3) 用 Newton 基底:均差表如下:xkf(xk)一阶均差二阶均差10-1-33/2247/35/6Newton 插值多项式为:N (x) = f (x ) + f x , x (x - x ) + f x , x , x (x - x )(x - x )2001001201= 0 + 3 (x -1) + 5 (x -1)(x +1) 26537=x2 +x -623735所以 f(x)的二次插值多项式为: N (x) = - + x + x22326由以上计算可知,三种方法得到的多项式是相同的。

5、6、在- 4 x 4 上给出 f (x) = ex 的等距节点函数表,若用二次插值求 ex 的近似值,要使截断误差不超过 10-6,问使用函数表的步长 h 应取多少?解:以 xi-1,xi,xi+1 为插值节点多项式的截断误差,则有R (x) = 1 f (x)(x - x)(x - x )(x - x),x (x, x)23!i-1ii+1i-1i+1式中 x= x - h, x= x + h.i-1i+11339 312 1e4R (x) =e4 max (x - x)(x - x )(x - x) e4h3 =h3x26i -1xx+i 1i-1ii+169 3令 e4h3 10-6 得

6、h 0.00658插值点个数1 + 4 - (-4) = 1216.8 1217N - 1是奇数,故实际可采用的函数值表步长4 - (-4)8h = 0.006579N - 112168、 f (x) = x 7 + x 4 + 3x + 1 ,求 f 20 ,21 ,L,27 及 f 20 ,21 ,L,28 。解:由均差的性质可知,均差与导数有如下关系:f x0, x ,L, x1n = f (n) (x) ,x a, bn!所以有: f 20 ,21 ,L,27 =f (7) (x) = 7! = 1 7!7!f (8) (x)0f 20 ,21 ,L,28 = 0 8!8!15、证明两

7、点三次 Hermite 插值余项是R (x) = f ( 4) (x )(x - x ) 2 (x - x) 2 / 4!,x (x , x)3kk +1kk +1并由此求出分段三次 Hermite 插值的误差限。证明:利用xk,xk+1上两点三次Hermite 插值条件H (x3k) = f (xk), H3(xk +1) = f (x)k +1H (x3k) = f (xk), H (x3k +1) = f (x)k +1知 R (x) = f (x) - H33(x) 有二重零点 xk 和k+1 设。R3 (x) = k (x)(x - xk ) 2 (x - xk +1 ) 2确定函数

8、 k(x):当 x = xk 或 xk+1 时 k(x)取任何有限值均可;当 x xk , xk +1 时, x (xk , xk +1 ) ,构造关于变量 t 的函数g (t) = f (t) - H 3 (t) - k (x)(x - xk ) 2 (x - xk +1 ) 2显然有g(x ) = 0, g(x) = 0, g(xkk +1) = 0g (xk) = 0, g (xk +1) = 01在xk,xx,xk+1上对 g(x)使用 Rolle 定理,存在h (xk, x) 及h2 (x , xk +1) 使得g (h ) = 0, g (h12) = 0在(xk,h ) , (h

9、 ,h112) , (h, x2k +1) 上对 g (x) 使用 Rolle 定理,存在hk1 (xk,h ) ,1h (h ,h ) 和h(h , x) 使得k 212k 32k +1g (hk1) = g (hk 2) = g (hk 3) = 0再依次对 g (t) 和 g (t) 使用 Rolle 定理,知至少存在x (x , x) 使得kk +1g (4) (x ) = 0而 g (4) (t) = f (4) (t) - k (4) (t)4!,将x 代入,得到1k (t) =4!f (4) (x ),x (xk ,x)k +1推导过程表明x 依赖于 x , x及 xkk +1综

10、合以上过程有: R (x) = f (4) (x )(x - x )2 (x - x)2 / 4!3kk +1确定误差限:记 I (x) 为 f(x) 在 a,b 上基于等距节点的分段三次 Hermite 插值函数。hb - ax = a + kh,(k = 0,1, n), h =kn在区间xk,xk+1上有1f (x) - I (x) = f (4) (x )(x - x )2 (x - x)2 / 4!max f (4) (x) max (x - x)2 (x - x)2hkk +14! a xbx x xkk +1kl +1而最值 max (x - xx x xk)2 (x - xk

11、+1)2 = max s 2 (s - 1)2 h 4 =0s11 h 4 , (x = x16k+ sh)kl +11进而得误差估计: f (x) - Ih(x) h 4 max f (4) (x)384a xb16 、求一个次数不高于 4 次的多项式 p(x) , 使它满足 p(0) = p(0) = 0 ,p(1) = p(1) = 0 , p(2) = 1 。解 : 满 足 H3(0) = H (0) = 0 , H33(1) = H (1) = 1 的 Hermite 插 值 多 项 式 为3(x = 0, x01H (x) = 13= 1)H (x )a3jj(x) + H (x

12、)b3j(x)jj =0= 1 - 2 x - 1 x - 0 2 + ( - 1) x - 0 21 - 0 1 - 0 x 1 - 0 = 2x 2 - x3设 P(x) = H3于是(x) + Ax 2 (x - 1) 2 ,令 P(2) = 1 得 A = 1411P(x) = 2x 2 - x3 +x 2 (x - 1) 2 =x 2 (x - 3)244第 3 章 曲线拟合的最小二乘法16、观测物体的直线运动,得出以下数据:i012345时间 t/s00.91.93.03.95.0距离 s/m010305080110求运动方程。解:经描图发现 t 和 s 近似服从线性规律。故做线性

13、模型s = a + bt,F = span1,t,计算离散内积有:(1,1)= 5 12 = 6 , (1,t)= 5t = 0 + 0.9 +1.9 + 3.0 + 3.9 + 5.0 = 14.7jj=0(t,t)= 5j=0j=0t 2 = 02 + 0.92 +1.92 + 3.02 + 3.92 + 5.02 = 53.63j(1, s)= 5j=0(t, s)= 5s = 0 +10 + 30 + 50 + 80 +110 = 280jt s = 0 0 + 0.910 +1.9 30 + 3.0 50 + 3.980 + 5.0110 = 1078j jj=0求解方程组得: 61

14、4.7 a 280 14.753.63 b = 1078a = -7.855048 , b = 22.253761运动方程为: s = -7.855048+ 22.253761t平方误差: d 2 =5j=0s - s(tjj2) 2.110217、已知实验数据如下:i01234Xi1925313844Yi19.032.349.073.397.8用最小二乘法求形如 y = a + bx2 的经验公式,并计算均方差。解: F = span1, x2 ,计算离散内积有:(1,1)= 4 12 = 5, (1, x2 )= 4x2 = 192 + 252 + 312 + 382 + 442 = 53

15、27jj=0(x2 , x2 )= 4j=0j=0x4 = 194 + 254 + 314 + 384 + 444 = 7277699j(1, y)= 4 yjj=0= 19.0 + 32.3 + 49.0 + 73.3 + 97.8 = 271.4(x2 , y)= 4j=0x2 yjj= 192 19.0 + 252 32.3 + 312 49.0 + 382 73.3 + 442 97.8 = 369321.5求解方程组得:55327 a 271.4 53277277699 b = 369321.5a 0.972579 , b = 0.05035所求公式为: y = 0.972579+

16、0.05035x21 4 2 2j均方误差: d = y(x j=0) - yj 0.1226第 4 章 数值积分与数值微分1、确定下列求积分公式中的待定参数,使其代数精度尽量高,并其代数精 度尽量高,并指明所构造出的求积公式所具有的代数精度:(1) h- hf (x)dx A-1f (-h) + A0f (0) + A f (h) ;1精品文档(2) 2h-2hf (x)dx A-1f (-h) + A0f (0) + A f (h) ;1(3) 1 f (x)dx f (-1) + 2 f (x ) + 3 f (x ) / 3 ;-112(4) h f (x)dx h f (0) + f

17、 (h) / 2 + ah2 f (0) - f (h)。0解:(1) h- hf (x)dx A-1f (-h) + A0f (0) + A f (h) ;1将 f (x) = 1, x, x2 分别代入公式两端并令其左右相等,得A + A + A = h 1dx = 2h-101-hh-hA+ 0 A + hA =xdx = 0-101-h解得。所求公式至少具有 2 次代数精确度。又由于h2 A + A 0 + h2 A = h x2dx = 2 h3-101- h 3故 h-hf (x)dx h f (-h) + 4h f (0) + h f (h) 具有 3 次代数精确度。333(2)

18、 2h-2hf (x)dx A-1f (-h) + A0f (0) + A f (h)1f (x) = 1, x, x2 分别代入公式两端并令其左右相等,得A + A + A = 2h 1dx = 4h-101-2h-hA + 0 A + hA = 2h xdx = 0-1012h-2h12h16(-h)2 A + A 0 + h2 A = x2dx = x3 =h3-101-2h 33-2h解得: A= A = 8h , A= - 4h-113032h8h8h令 f (x) = x3 ,得x3dx = 0 =(-h)3 + h3 = 0-2h33令 f (x) = x4 ,得 x5 2h2h

19、 x4 dx = =64h58h8h-+=( h)4h416h5-2h 5 -2h5333故求积分公式具有 3 次精确度。(3) 1 f (x)dx f (-1) + 2 f (x ) + 3 f (x ) / 3-112当 f (x) = 1 时,易知有1 f (x)dx f (-1) + 2 f (x ) + 3 f (x ) / 3-112令求积分公式对 f (x) = x, x2 准确成立,即)31 xdx = 0 = -1+ 2x + 3x-1(1212-1+ 2x 2 + 3x 2 x2dx =12-13x = -0.2898979 x = 0.6898979精品文档则解得 1或

20、1 x = 0.5265986x = -0.126598622将 f (x) = x3 代入已确定的积分公式,则1 f (x)dx f (-1) + 2 f (x ) + 3 f (x ) / 3-112故所求积分式具有 2 次代数精确度。(4) h f (x)dx h f (0) + f (h) / 2 + ah2 f (0) - f (h)0当 f (x) = 1,x 时,有h 1dx h1+1/ 2 + ah2 0 - 00h xdx h0 + h/ 2 + ah2 1-10故令 f (x) = x2 时求积公式准确成立,即h x2 dx h0 + h2 / 2 + ah2 0 - 2h

21、0解得a = 1 。12将 f (x) = x3 , x4 代入上述确定的求积分公式,有 x4 h1h x3dx = = h0 + h3 / 2 +h20 - 3h2 0 4 120 x5 h1h x4 dx = h0 + h4 / 2 +h2 0 - 4h4 0 5 120故所求积公式具有 3 次代数精确度。2、分别用梯形公式和辛普森公式计算下列积分:(1) 1x0 4 + x2dx, n = 8;(2) 91(3) p 60xdx, n = 4;4 - sin2 q dq, n = 6解(1)复化梯形公式, h = 182 T = h f (0) + 278k =1f (x ) + fk(

22、1) = 0.1114024复化辛普森公式, h = 186 S = h f (0) + 478k =0f (x1k +2) + 47k =1f (x ) + fk(1) = 0.1115718(2) h = 2 , T = h f (1)+ 23f (x ) + f (9) = 17.306000542 kk =1S = h f (1)+ 43f (x) + 43f (x ) + f (9) = 16.723750546 k =0k + 2kk =11(3) h = p , T366= h f (0) + 252 k =1f (x ) + fkp =( 6 )1.0356841 6 S =

23、h f (0) + 456k =0f (x1k +2) + 45k =1f (x ) + fkp ( ) = 1.03576396 5、推导下列三种矩形求积公式:bf (h)f (x)dx = (b - a) f (a) +(b - a)2 ;a2bf (h)f (x)dx = (b - a) f (a) -(b - a)2 ;a2ba + bf (h ) f (x)dx = (b - a) f () +(b - a)3 。a224解:(1)左矩形公式,将 f(x)在 a 处展开,得f (x) = f (a) + f (x)(x - a),x (a, x)两边在a,b上积分,得b f (x)d

24、x = b f (a)dx + b f (x)(x - a)dxaaa= (b - a) f (a) + b f (x)(x - a)dxa由于 x-a 在a,b上不变号,故由积分第二中值定理,有h (a, b)b f (x)dx = (b - a) f (a) + f (h )b (x - a)dxaa从而有b f (x)dx = (b - a) f (a) + 1 f (h)(b - a)2 ,h (a, b)a2(2) 右矩形公式,同(1),将 f(x)在 b 点处展开并积分,得b f (x)dx = (b - a) f (a) - 1 f (h)(b - a)2 ,h (a, b)a2

25、(3) 中矩形分式,将 f (x) 在 a + b 处展开,得2 xxa + ba + ba + ba + bf (x) = f () + f ()(x -) + f ( )(x -)2 , (a, b) 2222两边积分并用积分中值定理,得ba + ba + bba + b1 ba + b f (x) = f ()(b - a) + f () (x -)dx + f (x )(x -)2dxa22a22 a2= f ( a + b )(b - a) + f (h ) b (x - a + b )2 dx2a2a + b1精品文档= f ()(b - a) +f (h)(b - a)3 ,h

26、(a, b) 2246、若分别使用复合梯形公式和复合辛普森公式计算积分 I = 1 exdx ,问区间0,1 01应分多少等份才能使截断误差不超过10-5 。2解:由于 f (x) = ex = f (x) = f (4) (x), b - a = 1由复合梯形公式的余项有: b - a1 1 21Rf= -h2 f (x ) e 10-51212 n2n解得n 212.85 可取n = 213 由辛普森公公式的余项有:R f = b - a h4 f (4) (x ) 1( 1 )41 10-5n28802880 n2解得n 3.707 可取n = 48、用龙贝格求积方法计算下列积分,使误差

27、不超过10-5(1)2 1p0exdx ;(2) 2p x sin xdx ;0(3) 3 x 1+ x2 dx 。0精品文档h n-1nT = 2 f (x ) + f (x ) + 2f (x ) , k = 0解:(1) T (k ) = 0nii=1k4k T2n(k -1) - T (k -1)n, k = 1,2,3,kT ( k )nT ( k ) 0T ( k ) 1T ( k ) 2T ( k ) 30T (0) = hn2 n-1 f (x ) + f (x ) + 2 f (x )0ni=1i 1T (1) =2nn4T(0) - T (0)4 -1n2T (2) =n4

28、2 T(1) - T (1)2n42 -1n3T (3) =n43 T(2) - T (2)2n43 -1n4k -10.77174330.72806990.71351210.71698280.71328700.71327200.71420020.71327260.71327170.7132717(2)kT ( k )T ( k )0103.4513132*10-61(3)8.6282830*10-7-4.4469230*10-2118、用三点公式求 f (x) =xf (x)值由下表给出:1(1+ x)2在 x = 1.0,1.1,1.2 处的导数值,并估计误差。的1.01.11.20.25

29、000.22680.2066解:三点求导公式为f (x ) = 1 -3 f (x ) + 4 f (x ) - f (x )+ h2 f (e )02h01230f (x ) = 1 - f (x ) + f (x )- h2 f (e )12h0161f (x ) = 1 f (x ) - 4 f (x ) + 3 f (x )+ h2f (e )22h01232e (x , x ), i = 0,1,2i02取表中 x = 1.0,1.1,1.2 ,分别将有关数值代入上面三式,即可得导数近似值。由 于 f (e ) maxf (x) = max= 4! = 0.75i1.0 x1.21.

30、0 x1.2254!(1+ x)5X1.01.11.2三点公式-0.247-0.217-0.187误差0.00250.001250.0025理论解-0.25-0.2159594-0.1878287从而可求得误差上限与导数值如下:数值积分法,令j (x) = f (x) ,由f (x) = f (x ) + xk +1 j(x)dx对积分采用梯形公式,得k +1kxkf (x) = f (x ) + xk +1 - xk j(x ) +j(x)- (xk +1 - xk )3 j (h ),h(x , x)k +1k2令 k=0,1,得kk +112kkkk +1j(x ) +j(x ) 2 f

31、 (x ) - f (x )01h10j(x ) +j(x ) 2 f (x ) - f (x )12h2同样对有1f (xk +1) = f (xk -1) + xk +1 j(x)dxxk -1f (x) = f (x) + xk +1 - xk -1 j(x) +j(x)- (xk +1 - xk -1 )3 j (h),h(x, x)k +1从而有k -12k -1k +112kkk -1k +1j(x ) +j(x ) 1 f (x ) - f (x )02h20精品文档代入数值,解方程,即得j (xk), k = 0,1,2 如下X1.01.11.2三点公式-0.247-0.217

32、-0.187误差-0.25-0.2159594-0.1878287理论解-0.25-0.2159594-0.1878287第 5 章 解线性方程的直接方法7、用列主元消去法解线性方程组 12x - 3x + 3x= 15-18 1 + 3 2 -3 = -15xxx123x + x + x = 6123并求出系数矩阵 A 的行列式的值。12-3315-183-1-15-183-1-15Ab771731= -183-1-15 0-135 06186 0761731 00186 226677 1116 722A = -1867= -66x = 3, x32= 2, x = 118、用直接三角分解求

33、线性方程组的解。1 x + 1 x + 1 x = 9 4 15 26 3111 x +x +x = 8 3 14 25 3 1 2 x+ x + 2x = 8123解:由公式u1i= a (i = 1,2, n), l1ii1= a / ui111, i = 2,3, nu = ariri- r -1 l urk kik =1, i = r, r +1, n;精品文档l = (airir- r -1 l uik krk =1) / urr, i = r +1, n;r n 知143421516- 160- 1-36451315 111 1 4A = LU = 00 456 11 10 0- 3 6045 2 -361 0013 100915 4 b = LY = 32 910 Y = 8-3618Y = -4 -154 11 451 6 9 11 13 UX = 0- X = Y = -4 60 0045 -154x = -227.08, x1215 = 476.92, x3= -177.69 0.1

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

当前位置:首页 > 办公、行业 > 待归类文档
版权提示 | 免责声明

1,本文(数值分析作业答案.docx)为本站会员(最好的沉淀)主动上传,163文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。
2,用户下载本文档,所消耗的文币(积分)将全额增加到上传者的账号。
3, 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(发送邮件至3464097650@qq.com或直接QQ联系客服),我们立即给予删除!


侵权处理QQ:3464097650--上传资料QQ:3464097650

【声明】本站为“文档C2C交易模式”,即用户上传的文档直接卖给(下载)用户,本站只是网络空间服务平台,本站所有原创文档下载所得归上传人所有,如您发现上传作品侵犯了您的版权,请立刻联系我们并提供证据,我们将在3个工作日内予以改正。


163文库-Www.163Wenku.Com |网站地图|