Answers to Exam 1(a) Wed 8 Oct 2003

  1. Suppose the basis of our floating-point numbers is ten and all numbers have a fraction of three decimal places long, with exponents ranging between -9 and +9.
    1. What is the machine precision in this number system?

      Answer:

             B^(-p) = 10^(-3)
      
    2. What is the result of 54.2+1.29 in this number system?

      Answer:

             54.2 = +.542  10^2
             1.29 = +.129  10^1
      
           +.542   10^2
           +.0129  10^2  (denormalize)
          ----------------
           +.5559  10^2 = +.555 10^2 = 55.5
                     (round)
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    

  2. Consider
                     x             dx          abs(f(x))
              --------------------------------------------
               1.454468e+00   1.006373e-02   1.057051e-07
               1.446418e+00   8.050988e-03   3.463744e-08
               1.439977e+00   6.440791e-03   1.135000e-08
    
    This sequence is obtained by Newton's method. The first column lists the successive approximations for a root, the "dx" in the second column is the increment added to the previous approximation to obtain the "x" at the current line. The last column lists the absolute value of the function evaluated at the approximation.
    1. Estimate the multiplicity of the root from this sequence.

      Answer:

               m-1                  1  
              ----- ~ 0.8  =>  1 - --- ~ 0.8  =>  m = 5
                m                   m   
      
    2. Use the multiplicity to find a more accurate value for the root.

      Answer:

               1.446418 - 5 x 6.440791e-03 = 1.414214
      
                                                            +--------+
                                                            |    /15 |
                                                            +--------+
    
  3. Consider the system Ax = b, A an n-by-n matrix, det A not zero, b an n-vector, with solution x. The calculated solution xx satisfies A xx = b. Let r = b - A xx. Show that
          ||r||                      ||x - xx||
         ------- <= ||A|| ||A^(-1)|| -----------
          ||b||                        ||x||
    

    Answer:

    1) r = b - A xx = A x - A xx = A(x-xx)
    
        => ||r|| <= ||A|| ||x - xx||
    
    2) x = A^(-1) b => ||x|| <= ||A^(-1)|| ||b||
    
                       ||x||
                    => ----- <= ||A^(-1)||
                       ||b||
    
                         1                   1
                    => ----- <= ||A^(-1)|| -----
                       ||b||               ||x||
    
    Combining 1) and 2) implies
          ||r||                      ||x - xx||
         ------- <= ||A|| ||A^(-1)|| -----------.
          ||b||                        ||x||
    
                                                            +--------+
                                                            |    /15 |
                                                            +--------+
    
  4. Consider f(x) = x^3 - ln(x+1) over the interval [0,1].
    1. Starting with [0,1], apply two steps of the golden section search method, and indicate on the graph below where you do the function evaluations.
      In addition, mark the new intervals as [a1,b1], [a2,b2], and [a3,b3] on the x-axis.

    2. Write the values for x1, x2, f(x1), and f(x2) in the table below:

      Answer:

         +--------+-----------+-----------+-----------+------------+
         |  step  |    x1     |     x2    |   f(x1)   |   f(x2)    |
         +========+===========+===========+===========+============+
         |    0   |  3.820E-1 |  6.180E-1 | -2.678E-1 | -2.452E-1  |
         |    1   |  2.361E-1 |  3.820E-1 | -1.988E-1 | -2.678E-1  |
         |    2   |  3.820E-1 |  4.721E-1 | -2.678E-1 | -2.815E-1  |
         +--------+-----------+-----------+-----------+------------+
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  5. Consider
                  [  4.447e-01   9.218e-01   4.057e-01  ]
             A =  [  6.154e-01   7.382e-01   9.355e-01  ]
                  [  7.919e-01   1.763e-01   9.169e-01  ]
    
    1. Compute the LU decomposition of A with partial pivoting. Use 4 decimal places with rounding, and write all floating-point numbers in scientific format.

      Answer:

                                 [  7.919e-01   1.763e-01   9.169e-01  ] 3
        A  ------------------->  [  6.154e-01   7.382e-01   9.355e-01  ] 2
                                 [  4.447e-01   9.218e-01   4.057e-01  ] 1
                   6.154
       R2 := R2 - ------- R1
                   7.919         [  7.919e-01   1.763e-01   9.169e-01  ] 3
      ------------------------>  [  7.771e-01   6.012e-01   2.230e-01  ] 2
                   4.447         [  5.616e-01   8.228e-01  -1.092e-01  ] 1
       R3 := R3 - ------- R1     
                   7.919         
      	                   [  7.919e-01   1.763e-01   9.169e-01  ] 3
      ------------------------>  [  5.616e-01   8.228e-01  -1.092e-01  ] 1
                                 [  7.771e-01   6.012e-01   2.230e-01  ] 2
                   6.012
       R3 := R3 - ------- R2
                   8.228         [  7.919e-01   1.763e-01   9.169e-01  ] 3
      ------------------------>  [  5.616e-01   8.228e-01  -1.092e-01  ] 1
                                 [  7.771e-01   7.307e-01   3.028e-01  ] 2
      
              [ 0 0 1 ]          [  1.000e+00   0.000e+00   0.000e+00  ]
          P = [ 1 0 0 ]      L = [  5.616e-01   1.000e+00   0.000e+00  ]
              [ 0 1 0 ]          [  7.771e-01   7.307e-01   1.000e+00  ]
      
                                 [  7.919e-01   1.763e-01   9.169e-01  ]
                             U = [  0.000e+00   8.228e-01  -1.092e-01  ]
                                 [  0.000e+00   0.000e+00   3.028e-01  ]
      
      
    2. What is the determinant of A?

      Answer:

            det(A) = det(P)det(L)det(U)
                   = (+1)(+1)(7.919e-01)(8.228e-01)(3.028e-01)
                   = 1.973e-01
      
                                                            +--------+
                                                            |    /30 |
                                                            +--------+