logo资料库

numerical analysis 2nd edition solution.pdf

第1页 / 共305页
第2页 / 共305页
第3页 / 共305页
第4页 / 共305页
第5页 / 共305页
第6页 / 共305页
第7页 / 共305页
第8页 / 共305页
资料共305页,剩余部分请下载后查看
CHAPTER 0 Fundamentals EXERCISES 0.1 Evaluating a Polynomial 3(1 + 1 3(5 + 1 3(1 + 1 3(6)))) = 2. 1 (a) P (x) = 1 + x(1 + x(5 + x(1 + x(6)))). P ( 1 P ( 1 P ( 1 3)2 + 1 3)4 + ( 1 3)4 + ( 1 3) = 6( 1 3)3 + 5( 1 3)3 + 5( 1 3)4 + 4( 1 3)3 − ( 1 3) + 1 = 1 + 1 3) = −3( 1 3) = 2( 1 3 + 1 = 1 + 1 1 (b) P (x) = 1 + x(−5 + x(5 + x(4 + x(−3)))) 1 (c) P (x) = 1 + x(0 + x(−1 + x(1 + x(2)))) 3)2 − 5( 1 3(−5 + 1 3)2 + 1 = 1 + 1 3(0 + 1 3(−1 + 1 3(1 + 1 2 (a) P (x) = 7+x(−3+x(−2+x(6))); P (− 1 2) = 7+(− 1 2)(−3+(− 1 2 (b) P (x) = 1 + x(−3 + x(1 + x(−3 + x(−1 + x(8))))); 2)(−1 + (− 1 2)(−3 + (− 1 2)(1 + (− 1 2 (c) P (x) = 4 + x(−2 + x(0 + x(0 + x(−2 + x(0 + x(4)))))); 2)(0 + (− 1 2)(0 + (− 1 2)(−2 + (− 1 2)2(1))) = 81/64. P (− 1 P (− 1 2) = 1 + ( 1 2) = 1 + (− 1 2) = 4 + (− 1 2)(−3 + (− 1 2)(−2 + (− 1 2)2(2 + ( 1 3 P ( 1 2)2(−4 + ( 1 3(5 + 1 3(4 + 1 3(−3)))) = 0 3(2)))) = 77/81. 2)(−2+(− 1 2)(8))))) = 45/16. 2)(6))) = 29/4. 2)(0 + (− 1 2)(4)))))) = 79/16. 2 + (5 − 2)( 1 2 + (5 − 3)(− 1 2) = 4 + 1 2) = 4 − 1 2 + (−1 − 2)( 1 2 − 1)(1 + ( 1 2))) = 8 2 − 3)(2)))) = 5 2))) = −4 2 + (−1 − 3)(− 1 2 − 2)(3 + ( 1 4 (a) P (5) = 1 + 5( 1 4 (b) P (−1) = 1 + (−1)( 1 5 (a) P ( 1 2(4 + ( 1 5 (b) P (− 1 2(4 + (− 1 6 (a) P (x) = a0 + x5(a5 + x5(a10 + x5a15)). The three multiplications x2 = x · x, x4 = x2 · x2, x5 = x4 · x are needed, together with 3 multiplications and 3 additions from the nested multiplication. Total of 6 multiplications and 3 additions. 6 (b) P (x) = x7(a7 + x5(a12 + x5(a17 + x5(a22 + x5a27)))). The four multiplications x2 = x · x, x4 = x2 · x2, x5 = x4 · x, x7 = x5 · x2 are needed, together with 5 multiplications and 4 additions from the nested multiplication. Total of 9 multiplications and 4 additions. 2 − 3)(2)))) = 41/4 2 − 1)(1 + (− 1 2 − 2)(3 + (− 1 7 The degree n polynomial with base points is P (x) = c1 + (x − r1)(c2 + (x − r2)(c3 + (x − r3)(c4 + . . . + (x− rn)cn+1))). The operations needed are n multiplications and 2n additions. COMPUTER PROBLEMS 0.1 1 The MATLAB command nest(50,ones(51,1),1.00001) gives 51.01275208274999, differing from (x51 − 1)/(x − 1) with x = 1.00001 by 4.76 × 10−12. c#2012 Pearson Education, Inc.
2 CHAPTER 0 FUNDAMENTALS 2 The command nest(99,(-1).ˆ(0:99),1.00001) gives −0.00050024507964763. The equivalent expression (1 − x100)/(1 + x) for x = 1.00001 differs by 1.713 × 10−16. EXERCISES 0.2 Binary Numbers 1 (a) (64)10 = (26)10 = (1000000)2 1 (b) (17)10 = (16 + 1)10 = (10001)2 1 (c) Therefore (79)10 = (1001111)2. 1 (d) 79 ÷ 2 = 39 R 1 39 ÷ 2 = 19 R 1 19 ÷ 2 = 9 R 1 9 ÷ 2 = 4 R 1 4 ÷ 2 = 2 R 0 2 ÷ 2 = 1 R 0 1 ÷ 2 = 0 R 1 227 ÷ 2 = 113 R 1 113 ÷ 2 = 56 R 1 56 ÷ 2 = 28 R 0 28 ÷ 2 = 14 R 0 7 R 0 14 ÷ 2 = 3 R 1 7 ÷ 2 = 1 R 1 3 ÷ 2 = 0 R 1 1 ÷ 2 = Therefore (227)10 = (11100011)2. 2 (a) (1/8)10 = (2−3)10 = (0.001)2 2 (b) (7/8)10 = (2−1 + 2−2 + 2−3)10 = (0.111)2 2 (c) (35/16)10 = (2 + 3/16)10 = (2 + 1/8 + 1/16)10 = (10.0011)2 c#2012 Pearson Education, Inc.
SECTION 0.2 BINARY NUMBERS 3 2 (d) 31/64 × 2 = 31/32 + 0 31/32 × 2 = 15/16 + 1 15/16 × 2 = 7/8 + 1 7/8 × 2 = 3/4 + 1 3/4 × 2 = 1/2 + 1 1/2 × 2 = 0 + 1 Therefore (31/64)10 = (0.011111)2. 3 (a) 10.5 = 10 + 0.5. Integer part: (10)10 = (8 + 2)10 = (1010)2. Fractional part: (0.5)10 = (0.1)2, so (10.5)10 = (1010.1)2. 3 (b) Therefore ( 1 3)10 = (0.01)2. 3 (c) 2 3 1 3 2 3 3 7 6 7 5 7 3 7 6 7 + 0 + 1 + 0 + 1 + 0 + 1 + 1 + 0 1 3 × 2 = 2 3 × 2 = 1 3 × 2 = ... 5 7 × 2 = 3 7 × 2 = 6 7 × 2 = 5 7 × 2 = 3 7 × 2 = ... Therefore ( 5 7)10 = (0.101)2. c#2012 Pearson Education, Inc.
4 CHAPTER 0 FUNDAMENTALS 3 (d) (12.8)10 = (12)10 + (0.8)10; (12)10 = (1100)2. 0.8 × 2 = 0.6 + 1 0.6 × 2 = 0.2 + 1 0.2 × 2 = 0.4 + 0 0.4 × 2 = 0.8 + 0 0.8 × 2 = 0.6 + 1 ... Therefore (12.8)10 = (1100.1100)2. 3 (e) (55.4)10 = (55)10 + (0.4)10; (55)10 = (32 + 16 + 4 + 2 + 1)10 = (110111)2. 0.4 × 2 = 0.8 + 0 0.8 × 2 = 0.6 + 1 0.6 × 2 = 0.2 + 1 0.2 × 2 = 0.4 + 0 0.4 × 2 = 0.8 + 0 ... Therefore (55.4)10 = (110111.0110)2. 3 (f) 0.1 × 2 = 0.2 + 0 0.2 × 2 = 0.4 + 0 0.4 × 2 = 0.8 + 0 0.8 × 2 = 0.6 + 1 0.6 × 2 = 0.2 + 1 0.2 × 2 = 0.4 + 0 ... Therefore (0.1)10 = (0.00011)2. 4 (a) 11.25 = 11 + 0.25. Integer part: (11)10 = (8 + 2 + 1)10 = (1011)2. Fractional part: (0.25)10 = (0.01)2, so (10.25)10 = (1011.01)2. c#2012 Pearson Education, Inc.
SECTION 0.2 BINARY NUMBERS 5 4 (b) Therefore ( 2 3)10 = (0.10)2. 4 (c) 1 3 2 3 1 3 1 5 2 5 4 5 3 5 1 5 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 2 3 × 2 = 1 3 × 2 = 2 3 × 2 = ... 3 5 × 2 = 1 5 × 2 = 2 5 × 2 = 4 5 × 2 = 3 5 × 2 = ... Therefore ( 3 5)10 = (0.1001)2. 4 (d) (3.2)10 = (3)10 + (0.2)10; (3)10 = (11)2. 0.2 × 2 = 0.4 + 0 0.4 × 2 = 0.8 + 0 0.8 × 2 = 0.6 + 1 0.6 × 2 = 0.2 + 1 0.2 × 2 = 0.4 + 0 ... Therefore (3.2)10 = (11.0011)2. c#2012 Pearson Education, Inc.
6 CHAPTER 0 FUNDAMENTALS 4 (e) (30.6)10 = (30)10 + (0.6)10; (30)10 = (16 + 8 + 4 + 2)10 = (11110)2. 0.6 × 2 = 0.2 + 1 0.2 × 2 = 0.4 + 0 0.4 × 2 = 0.8 + 0 0.8 × 2 = 0.6 + 1 0.6 × 2 = 0.2 + 1 ... Therefore (30.6)10 = (11110.1001)2. 4 (f) (99.9)10 = (99)10 + (0.9)10; (99)10 = (64 + 32 + 2 + 1)10 = (1100011)2. 0.9 × 2 = 0.8 + 1 0.8 × 2 = 0.6 + 1 0.6 × 2 = 0.2 + 1 0.2 × 2 = 0.4 + 0 0.4 × 2 = 0.8 + 0 0.8 × 2 = 0.6 + 1 ... Therefore (99.9)10 = (1100011.11100)2. 5 (π)10 = (3)10 + (π − 3)10 0.14159265 × 2 = 0.28318531 + 0 0.28318531 × 2 = 0.56637061 + 0 0.56637061 × 2 = 0.13274123 + 1 0.13274123 × 2 = 0.26548246 + 0 0.26548246 × 2 = 0.53096491 + 0 0.53096491 × 2 = 0.06192983 + 1 0.06192983 × 2 = 0.12385966 + 0 0.12385966 × 2 = 0.24771932 + 0 0.24771932 × 2 = 0.49543864 + 0 0.49543864 × 2 = 0.99087728 + 0 0.99087728 × 2 = 0.98175455 + 1 0.98175455 × 2 = 0.96350910 + 1 0.96350910 × 2 = 0.92701821 + 1 ... c#2012 Pearson Education, Inc.
SECTION 0.2 BINARY NUMBERS 7 Therefore (π)10 = (11.0010010000111 . . .)2. 6 (e)10 = (2)10 + (e − 2)10 0.71828183 × 2 = 0.43656366 + 1 0.43656366 × 2 = 0.87312731 + 0 0.87312731 × 2 = 0.74625463 + 1 0.74625463 × 2 = 0.49250926 + 1 0.49250926 × 2 = 0.98501851 + 0 0.98501851 × 2 = 0.97003702 + 1 0.97003702 × 2 = 0.94007404 + 1 0.94007404 × 2 = 0.88014809 + 1 0.88014809 × 2 = 0.76029617 + 1 0.76029617 × 2 = 0.52059234 + 1 0.52059234 × 2 = 0.04118468 + 1 0.04118468 × 2 = 0.08236937 + 0 0.08236937 × 2 = 0.16473874 + 0 ... Therefore (e)10 = (10.1011011111100 . . .)2. implies x = 1 7 (f) 7 (h) 2 + 1 8)10 = (93/8)10. Therefore (110.10)2 = (6 + 2 3. Therefore (10111.01)2 = (23 + 1 3)10 = (70/3)10. 7 (a) (1010101)2 = (20 + 22 + 24 + 26)10 = (1 + 4 + 16 + 64)10 = (85)10 7 (b) (1011.101)2 = (23 + 21 + 20 + 2−1 + 2−3)10 = (11 + 1 7 (c) (10111.01)2 = (24 + 22 + 21 + 20)10 + (0.01)2. Set x = (0.01)2. Then 22x− x = (01)2 = 1 7 (d) (110.10)2 = (22 + 21)10 + (0.10)2. Set x = (0.10)2. Then 22x − x = (10)2 implies x = 2 3. 7 (e) (10.110)2 = (2)10 + (0.110)2. Set x = (0.110)2. Then 23x − x = (110)2 = 6 implies 2 )10, where x = (0.101)2. Since (110.1101)2 = (6)10 + ( 1 8(0.1101)2. Set x = (0.1101)2. Then 24x−x = (1101)2 = (111.1)2 = (7)10 + (0.1)2 = (7)10 + x, where x = (0.1)2. Since 21x − x = (1)2, x = 1, 23x − x = (101)2 = 5, x = 5/7. Therefore (110.1101)2 = ( 13 13, implying that x = 13 4 + 1 7)10 = (20/7)10. 2)10 + (0.0101)2 = ( 13 x = 6/7. Therefore (10.110)2 = (2 + 6 15. Therefore (10.0101101)2 = ( 9 7 (g) (10.0101101)2 = (2)10 +( 1 13 15)10 = (283/120)10. 2 + 5 7 1 2)10 = (48/7)10. 2 + x 8 3)10 = (20/3)10. 4)10 + 1 and (111.1)2 = (7 + 1)10 = (8)10. 8 (a) (11011)2 = (20 + 21 + 23 + 24)10 = (1 + 2 + 8 + 16)10 = (27)10 8 (b) (110111.001)2 = (25 + 24 + 22 + 21 + 20 + 2−3)10 = (55 + 1 8)10. 8 (c) (111.001)2 = (22 + 21 + 20)10 + (0.001)2. Set x = (0.001)2. Then 23x − x = (001)2 = 1 implies x = 1/7. Therefore (111.001)2 = (7 + 1/7)10. c#2012 Pearson Education, Inc.
8 CHAPTER 0 FUNDAMENTALS 8 (d) (1010.01)2 = (23 + 21)10 + (0.01)2. Set x = (0.01)2. Then 22x− x = (01)2 implies x = 1 3. 8 (e) (10111.10101)2 = (10111.10)2 = (24 + 22 + 21 + 20)10 + (0.10)2. Set x = (0.10)2. Then Therefore (1010.01)2 = (10 + 1 3)10 = (10 + 1/3)10. 8 (f) (1111.010001)2 = (15)10 + (1/4)10 + 1 22x − x = (10)2 = 2 implies x = 2/3. Therefore (10111.10101)2 = (23 + 2 Since 23x − x = (001)2 = 5, x = 1/7. Therefore (1111.010001)2 = (15 + 1/4 + 1 (15 + 15/56)10. 8(0.001)2 = (15 + 1/4 + x 8 )10, where x = (0.001)2. 1 7)10 = 3)10. 8 EXERCISES 0.3 Floating Point Representation of Real Numbers 1 (a) ( 1 1 (b) ( 1 4)10 = (0.01)2; fl( 1 3)10 = (0.01)2 = 4) = +1.0 × 2−2. +1. 0101010101010101010101010101010101010101010101010101 0101 . . . × 2−2. The Rounding to Nearest Rule says to round down when the 53rd bit is 0. 3) = +1. 0101010101010101010101010101010101010101010101010101 × 2−2. fl( 1 1 (c) ( 2 3)10 = (0.10)2 = +1. 0101010101010101010101010101010101010101010101010101 0101 . . . × 2−1. 3) = +1. 0101010101010101010101010101010101010101010101010101 × 2−1. fl( 2 +1. 1100110011001100110011001100110011001100110011001100 1100 . . . × 2−1. The Rounding to Nearest Rule says to round up since the 53rd bit is nonzero, and further bits are nonzero. fl(0.9) = +1. 1100110011001100110011001100110011001100110011001101 × 2−1. 1 (d) (0.9)10 = (0.11100)2 = 2 (a) (9.5)10 = (1001.1)2; fl(9.5) = 1.0011 × 23. 2 (b) (9.6)10 = (1001.1001)2 = 1.0011001 × 23 = +1. 0011001100110011001100110011001100110011001100110011 0011 . . . × 23. fl(9.6) = +1. 0011001100110011001100110011001100110011001100110011 × 23. 2 (c) (100.2)10 = (1100100.0011)2 = 1.1001000011 × 26 = +1. 1001000011001100110011001100110011001100110011001100 1100 . . . × 26. fl(100.2) = +1. 1001000011001100110011001100110011001100110011001101 × 26. 2 (d) ! 44 7"10 = (6 + 2 +1. 1001001001001001001001001001001001001001001001001001 0010 . . . × 22. fl! 44 7" = +1. 1001001001001001001001001001001001001001001001001001 × 22. 3 Note that fl(5) = 1.01× 22. Adding 1 as bit 3, 4, . . . , 52 of the mantissa will not incur rounding 7)10 = (110.010)2 = error. These correspond to 2−k for k = 1, 2, . . . , 50. 4 Note that fl(19) = 1.0011× 24. Adding 1 to bit 52 of the mantissa, corresponding to 19 + 2−48, will not be rounded away, and so 48 is the largest such k. c#2012 Pearson Education, Inc.
分享到:
收藏