Answers to Exam 1(b) 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 76.3+2.98 in this number system?

      Answer:

              76.3 = +.763   10^2
              2.98 = +.298   10^1
      
             +.763   10^2
             +.0298  10^2  (denormalize)
            --------------
             +.7928  10^2 = +.793  10^2 = 79.3
                       (round)
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    

  2. Consider
                     x             dx          abs(f(x))
              --------------------------------------------
               1.754039e+00   1.099409e-02   1.063084e-05
               1.746710e+00   7.329393e-03   3.149880e-06
               1.741823e+00   4.886262e-03   9.332978e-07
    
    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     2
               ----- ~ .6667  =>  1 - --- = ---  =>  m = 3
                 m                     m     3
      
    2. Use the multiplicity to find a more accurate value for the root.

      Answer:

               1.746710 - 3 x 4.886262e-03 = 1.732051
      
                                                            +--------+
                                                            |    /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 - 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 |  6.737E-1 |  6.180E-1  |
         |    1   |  6.180E-1 |  7.639E-1 |  6.180E-1 |  6.819E-1  |
         |    2   |  5.279E-1 |  6.180E-1 |  6.192E-1 |  6.180E-1  |
         +--------+-----------+-----------+-----------+------------+
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  5. Consider
                  [  4.102e-01   3.529e-01   1.389e-01  ]
             A =  [  8.936e-01   8.132e-01   2.028e-01  ]
                  [  5.789e-02   9.861e-03   1.987e-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:

                                [  8.936e-01   8.132e-01   2.028e-01  ] 2
          A  --------------->   [  4.102e-01   3.529e-01   1.389e-01  ] 1
                                [  5.789e-02   9.861e-03   1.987e-01  ] 3
                  4.102
      R2 := R2 - ------- R1
                  8.936         [  8.936e-01   8.132e-01   2.028e-01  ] 2
      ----------------------->  [  4.590e-01  -2.036e-02   4.581e-02  ] 3
                  5.789         [  6.478e-02  -4.282e-02   1.856e-01  ] 1
      R3 := R3 - ------- R1
                  8.936
                                [  8.936e-01   8.132e-01   2.028e-01  ] 2
      ----------------------->  [  6.478e-02  -4.282e-02   1.856e-01  ] 1
                                [  4.590e-01  -2.036e-02   4.581e-02  ] 3
                  2.036
      R3 := R3 - ------- R2
                  4.282         [  8.936e-01   8.132e-01   2.028e-01  ] 2
      ----------------------->  [  6.478e-02  -4.282e-02   1.856e-01  ] 1
                                [  4.590e-01   4.755e-01  -4.244e-02  ] 3
      
              [ 0 1 0 ]         [  1.000e+00   0.000e+00   0.000e+00  ]
          P = [ 0 0 1 ]     L = [  6.478e-02   1.000e+00   0.000e+00  ]
              [ 1 0 0 ]         [  4.590e-01   4.755e-01   1.000e+00  ]
      
                                [  8.936e-01   8.132e-01   2.028e-01  ]
                            U = [  0.000e+00  -4.282e-02   1.856e-01  ]
                                [  0.000e+00   0.000e+00  -4.244e-02  ]
      
    2. What is the determinant of A?

      Answer:

              det(A) = det(P)det(L)det(U)
                     = (+1)(+1)(8.936e-01)(-4.282e-02)(-4.244e-02)
                     = 1.624e-03
      
                                                            +--------+
                                                            |    /30 |
                                                            +--------+