Answers to Exam 1(c) Wed 20 Feb 2002

  1. Consider the representation of floating-point numbers with base 10 and 2 digits in the fraction part. The values for the exponents are between -10 and +10.

    1. What is the machine precision in this number system?

      Answer:

             B^(-p) = 10^(-2)
      

    2. Represent the numbers 387 and 25 as floating point numbers and illustrate the calculation of 387+25, using rounding. What is the calculated sum?

      Answer:

            387 = +.39 10^3
             25 = +.25 10^2
      
      denormalize 25 and round:
      
             25 = +.03 10^3
            387 = +.39 10^3
                ------------
                  +.42 10^3
      
      The calculated sum is 420.
      
                                                            +--------+
                                                            |    /15 |
                                                            +--------+
    

  2. Below make the plot of g(x) = 21/(x-4). Starting at x_0 = 13, illustrate on the plot below how to produce four more points defined by x(k+1) = g(x(k)), k=0,1,...

    Answer: Follow the link for the cobweb picture.

    Compute the convergence rate of this fixed-point iteration

    1. for x=-3:

      Answer:

             g(x) = 21*(x-4)^(-1)
             g'(x) = -21*(x-4)^(-2)
             g'(-3) = -21/7^2 = -21/49 = -3/7
      

    2. for x=7:

      Answer:

             g'(7) = -21/3^2 = -21/9 = -7/3
      

    What conclusions can you make from the rates you computed above?

    Answer:

           |g'(-3)| < 1 : linear convergence
           |g'(7)| > 1 : divergence
    
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    

  3. Apply 3 steps of the golden section search method to find the minimum of the function f(x) = x^5 - 4x in the interval [0,7]. Write the values for a, b, x_1, x_2, f(x_1), and f(x_2) in the table (4 decimal places):

    Answer:

    +------+---------+---------+---------+---------+----------+----------+
    | step |    a    |    b    |   x_1   |   x_2   |  f(x_1)  |  f(x_2)  |
    +------+---------+---------+---------+---------+----------+----------+
    |   0  |  0.000  |  7.000  |  2.674  |  4.326  | 1.260E+2 | 1.498E+3 |
    |   1  |  0.000  |  4.326  |  1.653  |  2.674  |  5.729   | 1.260E+2 |
    |   2  |  0.000  |  2.674  |  1.021  |  1.653  | -2.974   |  5.729   |
    +------+---------+---------+---------+---------+----------+----------+
    
                                                            +--------+
                                                            |    /15 |
                                                            +--------+
    

  4. Consider the matrix
               [ 8.216E-01    8.180E-01 ]
           A = [                        ]
               [ 6.449E+10    6.602E-01 ]
    
    with its inverse
    
               [ -1.251E-11   1.550E-11 ]
      A^(-1) = [                        ].
               [  1.223E+00  -1.558E-11 ]
    
    

    1. Compute the condition number of A using the norm ||.||_1.

      Answer:

             ||A||_1 = 6.449E+10 + 6.602E-1 = 6.449E+10
      
             ||A^(-1)||_1 = 1.223E+0 + |-1.558E-11| = 1.223E+0
      
             cond(A) = ||A||_1*||A^(-1)||_1 = 7.887E+10
      

    2. Suppose we wish to solve the system A x = b, using the matrix A from above. Assuming a relative error of 10^(-16) on the coefficients of the matrix, what is the bound on the relative error of the solution?

      Answer:

             ||x - xx||
             ----------  <= cond(A)*10^(-16) = 7.887E+10 * 10^(-16)
                ||x||                        = 7.887E-6
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    

  5. Consider the matrix
                [   5.000    3.000    6.000  ]
            A = [   7.000    1.000    3.000  ].
                [   4.000    1.000    5.000  ]
    

    1. Compute the LU decomposition of A with partial pivoting.

      Calculate with four decimal places, using rounding: write the answer of every step rounded to four decimal places, and use the rounded number in the calculations of the next step.

      Answer:

                                         [   7.000    1.000    3.000  ] 2
             A  ---------------------->  [   5.000    3.000    6.000  ] 1
                                         [   4.000    1.000    5.000  ] 3
      
      
                  R2 = R2 - (5/7)*R1     [   7.000    1.000    3.000  ] 2
                ---------------------->  [   0.7143   2.286    3.857  ] 1
                  R3 = R3 - (4/7)*R1     [   0.5714   0.4286   3.286  ] 3
      
      
                  R3 = R3 - 0.4286/2.286*R2     [   7.000    1.000    3.000  ] 2
                ----------------------------->  [   0.7143   2.286    3.857  ] 1
                                                [   0.5714   0.1875   2.563  ] 3
      

    2. What is the determinant of A?

      Answer:

              det(A) = det(P*L*U)
                     = det(P)*det(L)*det(U)
                     = (-1)*1*(-7.000)*2.286*2.563
                     = -41.01
      
                                                            +--------+
                                                            |    /30 |
                                                            +--------+