Skip to content
Textbook Guides

Solution Manual for Numerical Analysis, 2nd Edition

Find all the textbook answers you need with Solution Manual for Numerical Analysis, 2nd Edition, featuring clear, step-by-step solutions.

Preview 16 of 309 pages

See the first 16 pages exactly as they appear in the document.

  1. Page 1
    Read page 1 as text

    ’ S S OLUTIONS M ANUAL N UMERICAL A NALYSIS S ECOND E DITION Timothy Sauer George Mason University

  2. Page 2
  3. Page 3
    Read page 3 as text

    i Table of Contents Chapter 0 Fundamentals 0.1 Evaluating a Polynomial 1 0.2 Binary Numbers 2 0.3 Floating Point Representation of Real Numbers 8 0.4 Loss of Significance 13 0.5 Review of Calculus 15 Chapter 1 Solving Equations 1.1 The Bisection Method 17 1.2 Fixed-Point Iteration 19 1.3 Limits of Accuracy 24 1.4 Newton’s Method 25 1.5 Root-Finding without Derivatives 28 Chapter 2 Systems of Equations 2.1 Gaussian Elimination 31 2.2 The LU Factorization 32 2.3 Sources of Error 35 2.4 The PA = LU factorization 40 2.5 Iterative Methods 45 2.6 Methods for Symmetric Positive-Definite Matrices 49 2.7 Nonlinear Systems of Equations 57 Chapter 3 Interpolation 3.1 Data and Interpolating Functions 61 3.2 Interpolation Error 65 3.3 Chebyshev Interpolation 69 3.4 Cubic Splines 73 3.5 Bézier Curves 83 Chapter 4 Least Squares 4.1 Least Squares and the Normal Equations 89 4.2 A Survey of Models 96 4.3 QR Factorization 103 4.4 Generalized Minimum Residual (GMRES) Method 112 4.5 Nonlinear Least Squares 118

  4. Page 4
    Read page 4 as text

    ii Chapter 5 Numerical Differentiation and Integration 5.1 Numerical Differentiation 123 5.2 Newton-Cotes Formulas for Numerical Integration 132 5.3 Romberg Integration 142 5.4 Adaptive Quadrature 146 5.5 Gaussian Quadrature 150 Chapter 6 Ordinary Differential Equations 6.1 Initial Value Problems 153 6.2 Analysis of IVP Solvers 162 6.3 Systems of Ordinary Differential Equations 170 6.4 Runge-Kutta Methods and Applications 176 6.5 Variable Step-Size Methods 187 6.6 Implicit Methods and Stiff Equations 187 6.7 Multistep Methods 190 Chapter 7 Boundary Value Problems 7.1 Shooting Method 203 7.2 Finite Difference Methods 207 7.3 Collocation and the Finite Element Method 216 Chapter 8 Partial Differential Equations 8.1 Parabolic Equations 221 8.2 Hyperbolic Equations 224 8.3 Elliptic Equations 226 8.4 Nonlinear partial differential equations 233 Chapter 9 Random Numbers and Applications 9.1 Random Numbers 235 9.2 Monte Carlo Simulation 238 9.3 Discrete and Continuous Brownian Motion 239 9.4 Stochastic Differential Equations 241 Chapter 10 Trigonometric Interpolation and the FFT 10.1 The Fourier Transform 249 10.2 Trigonometric Interpolation 252 10.3 The FFT and Signal Processing 261

  5. Page 5
    Read page 5 as text

    iii Chapter 11 Compression 11.1 The Discrete Cosine Transform 267 11.2 Two-Dimensional DCT and Image Compression 272 11.3 Huffman Coding 276 11.4 Modified DCT and Audio Compression 280 Chapter 12 Eigenvalues and Singular Values 12.1 Power Iteration Methods 289 12.2 QR Algorithm 293 12.3 Singular Value Decomposition 297 12.4 Applications of the SVD 300 Chapter 13 Optimization 13.1 Unconstrained Optimization without Derivatives 303 13.2 Unconstrained Optimization with Derivatives 305

  6. Page 6
    Read page 6 as text

    CHAPTER 0 Fundamentals EXERCISES 0.1 Evaluating a Polynomial 1 (a) P ( x ) = 1 + x (1 + x (5 + x (1 + x (6)))) . P ( 1 3 ) = 6( 1 3 ) 4 + ( 1 3 ) 3 + 5( 1 3 ) 2 + 1 3 + 1 = 1 + 1 3 (1 + 1 3 (5 + 1 3 (1 + 1 3 (6)))) = 2 . 1 (b) P ( x ) = 1 + x ( − 5 + x (5 + x (4 + x ( − 3)))) P ( 1 3 ) = − 3( 1 3 ) 4 + 4( 1 3 ) 3 + 5( 1 3 ) 2 − 5( 1 3 ) + 1 = 1 + 1 3 ( − 5 + 1 3 (5 + 1 3 (4 + 1 3 ( − 3)))) = 0 1 (c) P ( x ) = 1 + x (0 + x ( − 1 + x (1 + x (2)))) P ( 1 3 ) = 2( 1 3 ) 4 + ( 1 3 ) 3 − ( 1 3 ) 2 + 1 = 1 + 1 3 (0 + 1 3 ( − 1 + 1 3 (1 + 1 3 (2)))) = 77 / 81 . 2 (a) P ( x ) = 7+ x ( − 3+ x ( − 2+ x (6))) ; P ( − 1 2 ) = 7+( − 1 2 )( − 3+( − 1 2 )( − 2+( − 1 2 )(6))) = 29 / 4 . 2 (b) P ( x ) = 1 + x ( − 3 + x (1 + x ( − 3 + x ( − 1 + x (8))))) ; P ( − 1 2 ) = 1 + ( − 1 2 )( − 3 + ( − 1 2 )(1 + ( − 1 2 )( − 3 + ( − 1 2 )( − 1 + ( − 1 2 )(8))))) = 45 / 16 . 2 (c) P ( x ) = 4 + x ( − 2 + x (0 + x (0 + x ( − 2 + x (0 + x (4)))))) ; P ( − 1 2 ) = 4 + ( − 1 2 )( − 2 + ( − 1 2 )(0 + ( − 1 2 )(0 + ( − 1 2 )( − 2 + ( − 1 2 )(0 + ( − 1 2 )(4)))))) = 79 / 16 . 3 P ( 1 2 ) = 1 + ( 1 2 ) 2 (2 + ( 1 2 ) 2 ( − 4 + ( 1 2 ) 2 (1))) = 81 / 64 . 4 (a) P (5) = 1 + 5( 1 2 + (5 − 2)( 1 2 + (5 − 3)( − 1 2 ))) = − 4 4 (b) P ( − 1) = 1 + ( − 1)( 1 2 + ( − 1 − 2)( 1 2 + ( − 1 − 3)( − 1 2 ))) = 8 5 (a) P ( 1 2 ) = 4 + 1 2 (4 + ( 1 2 − 1)(1 + ( 1 2 − 2)(3 + ( 1 2 − 3)(2)))) = 5 5 (b) P ( − 1 2 ) = 4 − 1 2 (4 + ( − 1 2 − 1)(1 + ( − 1 2 − 2)(3 + ( − 1 2 − 3)(2)))) = 41 / 4 6 (a) P ( x ) = a 0 + x 5 ( a 5 + x 5 ( a 10 + x 5 a 15 )) . The three multiplications x 2 = x · x, x 4 = x 2 · x 2 , x 5 = x 4 · 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 ) = x 7 ( a 7 + x 5 ( a 12 + x 5 ( a 17 + x 5 ( a 22 + x 5 a 27 )))) . The four multiplications x 2 = x · x, x 4 = x 2 · x 2 , x 5 = x 4 · x, x 7 = x 5 · x 2 are needed, together with 5 multiplications and 4 additions from the nested multiplication. Total of 9 multiplications and 4 additions. 7 The degree n polynomial with base points is P ( x ) = c 1 + ( x − r 1 )( c 2 + ( x − r 2 )( c 3 + ( x − r 3 )( c 4 + . . . + ( x − r n ) c n +1 ))) . The operations needed are n multiplications and 2 n additions. COMPUTER PROBLEMS 0.1 1 The M ATLAB command nest(50,ones(51,1),1.00001) gives 51 . 01275208274999 , differing from ( x 51 − 1) / ( x − 1) with x = 1 . 00001 by 4 . 76 × 10 − 12 .

  7. Page 7
    Read page 7 as text

    2 C HAPTER 0 FUNDAMENTALS 2 The command nest(99,(-1).ˆ(0:99),1.00001) gives − 0 . 00050024507964763 . The equivalent expression (1 − x 100 ) / (1 + x ) for x = 1 . 00001 differs by 1 . 713 × 10 − 16 . EXERCISES 0.2 Binary Numbers 1 (a) (64) 10 = (2 6 ) 10 = (1000000) 2 1 (b) (17) 10 = (16 + 1) 10 = (10001) 2 1 (c) 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 Therefore (79) 10 = (1001111) 2 . 1 (d) 227 ÷ 2 = 113 R 1 113 ÷ 2 = 56 R 1 56 ÷ 2 = 28 R 0 28 ÷ 2 = 14 R 0 14 ÷ 2 = 7 R 0 7 ÷ 2 = 3 R 1 3 ÷ 2 = 1 R 1 1 ÷ 2 = 0 R 1 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

  8. Page 8
    Read page 8 as text

    S ECTION 0.2 B INARY N UMBERS 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) 1 3 × 2 = 2 3 + 0 2 3 × 2 = 1 3 + 1 1 3 × 2 = 2 3 + 0 . . . Therefore ( 1 3 ) 10 = (0 . 01) 2 . 3 (c) 5 7 × 2 = 3 7 + 1 3 7 × 2 = 6 7 + 0 6 7 × 2 = 5 7 + 1 5 7 × 2 = 3 7 + 1 3 7 × 2 = 6 7 + 0 . . . Therefore ( 5 7 ) 10 = (0 . 101) 2 .

  9. Page 9
    Read page 9 as text

    4 C HAPTER 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 .

  10. Page 10
    Read page 10 as text

    S ECTION 0.2 B INARY N UMBERS 5 4 (b) 2 3 × 2 = 1 3 + 1 1 3 × 2 = 2 3 + 0 2 3 × 2 = 1 3 + 1 . . . Therefore ( 2 3 ) 10 = (0 . 10) 2 . 4 (c) 3 5 × 2 = 1 5 + 1 1 5 × 2 = 2 5 + 0 2 5 × 2 = 4 5 + 0 4 5 × 2 = 3 5 + 1 3 5 × 2 = 1 5 + 1 . . . 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 .

  11. Page 11
    Read page 11 as text

    6 C HAPTER 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 . 1 1100) 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 . . .

  12. Page 12
    Read page 12 as text

    S ECTION 0.2 B INARY N UMBERS 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 . 7 (a) (1010101) 2 = (2 0 + 2 2 + 2 4 + 2 6 ) 10 = (1 + 4 + 16 + 64) 10 = (85) 10 7 (b) (1011 . 101) 2 = (2 3 + 2 1 + 2 0 + 2 − 1 + 2 − 3 ) 10 = (11 + 1 2 + 1 8 ) 10 = (93 / 8) 10 . 7 (c) (10111 . 01) 2 = (2 4 + 2 2 + 2 1 + 2 0 ) 10 + (0 . 01) 2 . Set x = (0 . 01) 2 . Then 2 2 x − x = (01) 2 = 1 implies x = 1 3 . Therefore (10111 . 01) 2 = (23 + 1 3 ) 10 = (70 / 3) 10 . 7 (d) (110 . 10) 2 = (2 2 + 2 1 ) 10 + (0 . 10) 2 . Set x = (0 . 10) 2 . Then 2 2 x − x = (10) 2 implies x = 2 3 . Therefore (110 . 10) 2 = (6 + 2 3 ) 10 = (20 / 3) 10 . 7 (e) (10 . 110) 2 = (2) 10 + (0 . 110) 2 . Set x = (0 . 110) 2 . Then 2 3 x − x = (110) 2 = 6 implies x = 6 / 7 . Therefore (10 . 110) 2 = (2 + 6 7 ) 10 = (20 / 7) 10 . 7 (f) (110 . 1101) 2 = (6) 10 + ( 1 2 ) 10 + (0 . 0101) 2 = ( 13 2 + x 2 ) 10 , where x = (0 . 101) 2 . Since 2 3 x − x = (101) 2 = 5 , x = 5 / 7 . Therefore (110 . 1101) 2 = ( 13 2 + 5 7 1 2 ) 10 = (48 / 7) 10 . 7 (g) (10 . 0101101) 2 = (2) 10 +( 1 4 ) 10 + 1 8 (0 . 1101) 2 . Set x = (0 . 1101) 2 . Then 2 4 x − x = (1101) 2 = 13 , implying that x = 13 15 . Therefore (10 . 010 1101) 2 = ( 9 4 + 1 8 13 15 ) 10 = (283 / 120) 10 . 7 (h) (111 . 1) 2 = (7) 10 + (0 . 1) 2 = (7) 10 + x , where x = (0 . 1) 2 . Since 2 1 x − x = (1) 2 , x = 1 , and (111 . 1) 2 = (7 + 1) 10 = (8) 10 . 8 (a) (11011) 2 = (2 0 + 2 1 + 2 3 + 2 4 ) 10 = (1 + 2 + 8 + 16) 10 = (27) 10 8 (b) (110111 . 001) 2 = (2 5 + 2 4 + 2 2 + 2 1 + 2 0 + 2 − 3 ) 10 = (55 + 1 8 ) 10 . 8 (c) (111 . 001) 2 = (2 2 + 2 1 + 2 0 ) 10 + (0 . 001) 2 . Set x = (0 . 001) 2 . Then 2 3 x − x = (001) 2 = 1 implies x = 1 / 7 . Therefore (111 . 001) 2 = (7 + 1 / 7) 10 .

  13. Page 13
    Read page 13 as text

    8 C HAPTER 0 F UNDAMENTALS 8 (d) (1010 . 01) 2 = (2 3 + 2 1 ) 10 + (0 . 01) 2 . Set x = (0 . 01) 2 . Then 2 2 x − x = (01) 2 implies x = 1 3 . Therefore (1010 . 01) 2 = (10 + 1 3 ) 10 = (10 + 1 / 3) 10 . 8 (e) (10111 . 1 0101) 2 = (10111 . 10) 2 = (2 4 + 2 2 + 2 1 + 2 0 ) 10 + (0 . 10) 2 . Set x = (0 . 10) 2 . Then 2 2 x − x = (10) 2 = 2 implies x = 2 / 3 . Therefore (10111 . 10101) 2 = (23 + 2 3 ) 10 . 8 (f) (1111 . 010001) 2 = (15) 10 + (1 / 4) 10 + 1 8 (0 . 001) 2 = (15 + 1 / 4 + x 8 ) 10 , where x = (0 . 001) 2 . Since 2 3 x − x = (001) 2 = 5 , x = 1 / 7 . Therefore (1111 . 010001) 2 = (15 + 1 / 4 + 1 8 1 7 ) 10 = (15 + 15 / 56) 10 . EXERCISES 0.3 Floating Point Representation of Real Numbers 1 (a) ( 1 4 ) 10 = (0 . 01) 2 ; fl ( 1 4 ) = +1 . 0 × 2 − 2 . 1 (b) ( 1 3 ) 10 = (0 . 01) 2 = +1 . 0101010101010101010101010101010101010101010101010101 0101 . . . × 2 − 2 . The Rounding to Nearest Rule says to round down when the 53 rd bit is 0 . fl ( 1 3 ) = +1 . 0101010101010101010101010101010101010101010101010101 × 2 − 2 . 1 (c) ( 2 3 ) 10 = (0 . 10) 2 = +1 . 0101010101010101010101010101010101010101010101010101 0101 . . . × 2 − 1 . fl ( 2 3 ) = +1 . 0101010101010101010101010101010101010101010101010101 × 2 − 1 . 1 (d) (0 . 9) 10 = (0 . 11100) 2 = +1 . 1100110011001100110011001100110011001100110011001100 1100 . . . × 2 − 1 . The Rounding to Nearest Rule says to round up since the 53 rd bit is nonzero, and further bits are nonzero. fl (0 . 9) = +1 . 1100110011001100110011001100110011001100110011001101 × 2 − 1 . 2 (a) (9 . 5) 10 = (1001 . 1) 2 ; fl (9 . 5) = 1 . 0011 × 2 3 . 2 (b) (9 . 6) 10 = (1001 . 1001) 2 = 1 . 001 1001 × 2 3 = +1 . 0011001100110011001100110011001100110011001100110011 0011 . . . × 2 3 . fl (9 . 6) = +1 . 0011001100110011001100110011001100110011001100110011 × 2 3 . 2 (c) (100 . 2) 10 = (1100100 . 0011) 2 = 1 . 100100 0011 × 2 6 = +1 . 1001000011001100110011001100110011001100110011001100 1100 . . . × 2 6 . fl (100 . 2) = +1 . 1001000011001100110011001100110011001100110011001101 × 2 6 . 2 (d) ( 44 7 ) 10 = (6 + 2 7 ) 10 = (110 . 010) 2 = +1 . 1001001001001001001001001001001001001001001001001001 0010 . . . × 2 2 . fl ( 44 7 ) = +1 . 1001001001001001001001001001001001001001001001001001 × 2 2 . 3 Note that fl (5) = 1 . 01 × 2 2 . Adding 1 as bit 3 , 4 , . . . , 52 of the mantissa will not incur rounding error. These correspond to 2 − k for k = 1 , 2 , . . . , 50 . 4 Note that fl (19) = 1 . 0011 × 2 4 . 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 .

  14. Page 14
    Read page 14 as text

    S ECTION 0.3 F LOATING P OINT R EPRESENTATION OF R EAL N UMBERS 9 5 (a) 1 + (2 − 51 + 2 − 53 ) = +1 . 0000000000000000000000000000000000000000000000000010 1 × 2 0 . fl (1 + (2 − 51 + 2 − 53 )) = +1 . 0000000000000000000000000000000000000000000000000010 × 2 0 , using the Round- ing to Nearest Rule. Therefore fl ((1 + (2 − 51 + 2 − 53 )) − 1) = . 0000000000000000000000000000000000000000000000000010 = 1 . 0000000000000000000000000000000000000000000000000000 × 2 − 51 = 2 − 51 . 5 (b) 1 + (2 − 51 + 2 − 52 + 2 − 53 ) = +1 . 0000000000000000000000000000000000000000000000000011 1 × 2 0 . fl (1 + (2 − 51 + 2 − 52 + 2 − 53 )) = +1 . 0000000000000000000000000000000000000000000000000100 × 2 0 , using the Round- ing to Nearest Rule. Therefore fl ((1 + (2 − 51 + 2 − 52 + 2 − 53 )) − 1) = . 0000000000000000000000000000000000000000000000000100 = 1 . 0000000000000000000000000000000000000000000000000000 × 2 − 50 = 2 − 50 . 6 (a) 1 + (2 − 51 + 2 − 52 + 2 − 54 ) = +1 . 0000000000000000000000000000000000000000000000000011 01 × 2 0 . fl (1 + (2 − 51 + 2 − 52 + 2 − 54 )) = +1 . 0000000000000000000000000000000000000000000000000011 × 2 0 , using the Round- ing to Nearest Rule. Therefore fl ((1 + (2 − 51 + 2 − 52 + 2 − 54 )) − 1) = . 0000000000000000000000000000000000000000000000000011 = 1 . 1000000000000000000000000000000000000000000000000000 × 2 − 51 = 2 − 51 + 2 − 52 = 3 " mach . 6 (b) 1 + (2 − 51 + 2 − 52 + 2 − 60 ) = +1 . 0000000000000000000000000000000000000000000000000011 00000001 × 2 0 . fl (1 + (2 − 51 + 2 − 52 + 2 − 60 )) = +1 . 0000000000000000000000000000000000000000000000000011 × 2 0 , using the Round- ing to Nearest Rule. Therefore fl ((1 + (2 − 51 + 2 − 52 + 2 − 60 )) − 1) = . 0000000000000000000000000000000000000000000000000011 = 1 . 1000000000000000000000000000000000000000000000000000 × 2 − 51 = 2 − 51 + 2 − 52 = 3 " mach . 7 (a) (8) 10 = (1000 . ) 2 = 1 . 0 × 2 3 . The biased exponent is 3+1023 = 1026 , which is 2 10 +2 . The sign is 0 (positive), so the sign/exponent is represented by the binary string 0100 0000 0010 . The mantissa is 52 zeros, so the machine representation is the 64 bits 0100 0000 0010 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 or 4020000000000000 in hex format. 7 (b) (21) 10 = (10101 . ) 2 = 1 . 0101 × 2 4 . The biased exponent is 4 + 1023 = 1027 = 2 10 + 3 , represented by 100 0000 0011 . The machine representation is 0100 0000 0011 0101 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000

  15. Page 15
    Read page 15 as text

    10 C HAPTER 0 F UNDAMENTALS or 4035000000000000 in hex format. 7 (c) (1 / 8) 10 = 1 . 0 × 2 − 3 . The biased exponent is − 3 + 1023 = 1020 = 2 10 − 4 , represented by 011 1111 1100 . The machine representation is 0011 1111 1100 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 or 3fc0000000000000 in hex format. 7 (d) (1 / 3) 10 = 1 . 01 × 2 − 2 , and after rounding down, fl (1 / 3) = 1 . 0101 . . . 0101 × 2 − 2 . The biased exponent is − 2 + 1023 = 1021 = 2 10 − 3 , represented by 011 1111 1101 . The machine representation is 0011 1111 1101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 or 3fd5555555555555 in hex format. 7 (e) (2 / 3) 10 = 1 . 01 × 2 − 1 , and after rounding down, fl (1 / 3) = 1 . 0101 . . . 0101 × 2 − 1 . The biased exponent is − 1 + 1023 = 1022 = 2 10 − 2 , represented by 011 1111 1110 . The machine representation is 0011 1111 1110 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 0101 or 3fe5555555555555 in hex format. 7 (f) (0 . 1) 10 = 1 . 1001 × 2 − 4 , and after rounding up, fl (0 . 1) = 1 . 1001 . . . 1001 1010 × 2 − 4 . The biased exponent is − 4 + 1023 = 1019 = 2 10 − 5 , represented by 011 1111 1011 . The machine representation is 0011 1111 1011 1001 1001 1001 1001 1001 1001 1001 1001 1001 1001 1001 1001 1010 or 3fb999999999999a in hex format. 7 (g) ( − 0 . 1) 10 = − 1 . 1001 × 2 − 4 , and after rounding, fl ( − 0 . 1) = − 1 . 1001 . . . 1001 1010 × 2 − 4 . The biased exponent is − 4 + 1023 = 1019 = 2 10 − 5 , represented by 011 1111 1011 . The machine representation is 1011 1111 1011 1001 1001 1001 1001 1001 1001 1001 1001 1001 1001 1001 1001 1010 or bfb999999999999a in hex format. 7 (h) ( − 0 . 2) 10 = − 1 . 1001 × 2 − 3 , and after rounding, fl ( − 0 . 2) = − 1 . 1001 . . . 1001 1010 × 2 − 3 . The biased exponent is − 3 + 1023 = 1020 = 2 10 − 4 , represented by 011 1111 1100 . The machine representation is 1011 1111 1100 1001 1001 1001 1001 1001 1001 1001 1001 1001 1001 1001 1001 1010 or bfc999999999999a in hex format. 8 Yes. Yes. No, under chopping, 1 / 3 + 2 / 3 = 1 − " mach . 9 (a) (7 / 3) 10 = 1 . 0010 × 2 1 , and after rounding, fl (7 / 3) = 1 . 0010 . . . 1010 1011 × 2 1 . (4 / 3) 10 = 1 . 01 × 2 0 , and after rounding, fl (4 / 3) = 1 . 01 . . . 0101 0101 × 2 0 . Subtracting gives 1 . 0010101010101010101010101010101010101010101010101011 0 × 2 1 − 0 . 1010101010101010101010101010101010101010101010101010 1 × 2 1 = 0 . 1000000000000000000000000000000000000000000000000000 1 × 2 1

  16. Page 16
    Read page 16 as text

    S ECTION 0.3 F LOATING P OINT R EPRESENTATION OF R EAL N UMBERS 11 that is normalized to = 1 . 0000000000000000000000000000000000000000000000000001 × 2 0 , which is 1 + " mach . After subtracting 1 , the result is that the double precision floating point version of (7 / 3 − 4 / 3) − 1 is " mach . 9 (b) (4 / 3) 10 = 1 . 01 × 2 0 , and after rounding, fl (4 / 3) = 1 . 01 . . . 0101 0101 × 2 0 . (1 / 3) 10 = 1 . 01 × 2 − 2 , and after rounding, fl (1 / 3) = 1 . 01 . . . 0101 0101 × 2 − 2 . Subtracting gives 1 . 0101010101010101010101010101010101010101010101010101 00 × 2 0 − 0 . 0101010101010101010101010101010101010101010101010101 01 × 2 0 = 0 . 1111111111111111111111111111111111111111111111111111 11 × 2 0 that normalizes to = 1 . 1111111111111111111111111111111111111111111111111111 1 × 2 − 1 and rounds to = 10 . 0000000000000000000000000000000000000000000000000000 × 2 − 1 which is 1 . 0 × 2 0 . After subtracting 1 , the result is machine zero, not " mach . 10 (a) No. 10 (b) Yes. 11 The associative law of addition fails for floating point addition with the Rounding to Nearest Rule, for example, because 1 + ( " mach / 2 + " mach / 2) = 1 + " mach > 1 , while (1 + " mach / 2) + " mach / 2 = 1 , because 1 + " mach / 2 = 1 . 12 (a) fl (1 / 3) = 1 . 0101 . . . 01 × 2 − 2 , with relative rounding error of 2 − 54 < " mach / 2 = 2 − 53 . 12 (b) fl (3 . 3) = 1 . 101001100110 . . . 0110 × 2 1 , 3 . 3 − fl (3 . 3) = 0 . 4 × 2 − 51 with relative rounding error of 8 " mach / 33 . 12 (c) fl (9 / 7) = 1 . 010010 . . . 0100101 × 2 0 , fl (9 / 7) − 9 / 7 = 3 " mach / 7 , with relative rounding error of " mach / 3 . 13 (a) 2 , represented by 010 . . . 0 (b) 2 − 511 , represented by 0010 . . . 0 (c) 0 , represented by 10 . . . 0 . When bit 4 through 12 is the nonzero bit, the floating point number is positive but less than 2 − 511 . When bit 13 through 64 is the nonzero bit, the number is positive and subnormal, so less than 2 − 511 . 14 (a) 0 (b) 2 − 51 (c) 2 − 51

293 more pages in the full document

Unlock it once and it stays in your library, ready to chat with or turn into flashcards.

Unlock the full document
See all

Study this document with CramX

Once it is in your library, every tool can work from it.