Answers to Exam 1(b) 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 13 and 577 as floating point numbers and illustrate the calculation of 13+577, using rounding. What is the calculated sum?

      Answer:

             13 = +.13 10^2
            577 = +.58 10^3
      
      denormalize 13 and round:
      
             13 = +.01 10^3
            577 = +.58 10^3
                ------------
                  +.59 10^3
      
      The calculated sum is 590.
      
                                                            +--------+
                                                            |    /15 |
                                                            +--------+
    

  2. Below make the plot of g(x) = 4/(x+3). Starting at x_0 = -7, 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=1:

      Answer:

             g(x) = 4*(x+3)^(-1)
             g'(x) = -4*(x+3)^(-2)
             g'(1) = -4/4^2 = -1/4
      

    2. for x=-4:

      Answer:

             g'(-4) = -4/(-1)^2 = -4
      

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

    Answer:

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

  3. Apply 3 steps of the golden section search method to find the minimum of the function f(x) = x^3 - 2x in the interval [0,2]. 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  |  2.000  |  0.7639 |  1.236  |  -1.082  | -0.5836  |
    |   1  |  0.000  |  1.236  |  0.4721 |  0.7639 |  -0.8390 | -1.082   |
    |   2  |  0.4721 |  1.236  |  0.7639 |  0.9442 |  -1.082  | -1.047   |
    +------+---------+---------+---------+---------+----------+----------+
    
                                                            +--------+
                                                            |    /15 |
                                                            +--------+
    

  4. Consider the matrix
               [  8.537E-01   4.966E-01  ]
           A = [                         ]
               [  5.936E-01   8.998E+08  ]
    
     with its inverse
    
               [  1.171E+00   -6.465E-10  ]
      A^(-1) = [                          ].
               [ -7.728E-10    1.111E-09  ]
    

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

      Answer:

              ||A||_1 = 4.966E-1 + 8.998E+8 = 8.998E+8
      
              ||A^(-1)||_1 = 1.171E+0 + |-7.728-10| = 1.171E+0
      
              cond(A) = ||A||_1*||A^(-1)||_1 = 1.054E+9
      

    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) = 1.054E+9 * 10^(-16)
                ||x||                        = 1.054E-7
      
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    

  5. Consider the matrix
              [  6.000     0.000     9.000  ]
          A = [  1.000     4.000     4.000  ].
              [  2.000     7.000     4.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:

                 R2 = R2 - (1/6)*R1      [  6.000    0.000    9.000  ] 1
            A  ----------------------->  [  0.1667   4.000    2.500  ] 2
                 R3 = R3 - (2/6)*R1      [  0.3333   7.000    1.000  ] 3
      
                                         [  6.000    0.000    9.000  ] 1
               ----------------------->  [  0.3333   7.000    1.000  ] 3
                                         [  0.1667   4.000    2.500  ] 2
      
                 R3 = R3 - (4/7)*R2      [  6.000    0.000    9.000  ] 1
               ----------------------->  [  0.3333   7.000    1.000  ] 3
                                         [  0.1667   0.5714    1.929  ] 2
      

    2. What is the determinant of A?

      Answer:

              det(A) = det(P*L*U)
                     = det(P)*det(L)*det(U)
                     = (-1)*1*(-6.000)*7.000*1.929
                     = -81.02
      
                                                            +--------+
                                                            |    /30 |
                                                            +--------+