Answers to Exam 1(c) Fri 7 Oct 2005

  1. Consider a floating-point number system with base 10. There are five digits in the fraction (mantissa) and the exponents range between -9 and +8.
    1. What is the smallest positive floating-point number in this number system?
          +.10000E-9 = 10^(-10)
      
    2. What is the result of 77.236 + 0.059321 in this number system?
          77.236 = +.77236E+2
          0.059321 = +.59321E-1 = +.00059321E+2 (denormalize)
      
          +.77236E+2
          +.00059321E+2
         ---------------
          +.77295321E+2 = +.77295E+2 = 77.295
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  2. Derive the formula for Newton's method for one equation f(x) = 0.
    Illustrate the working of Newton's method with a plot.
      Taylor expansion of f(x+dx) = f(x) + dx*f'(x) + O((dx)^2).
      We discard the higher order term O((dx)^2).
      We look for the update dx to x so that f(x+dx) = 0.
      Therefore, dx must satisfy 0 = f(x) + dx*f'(x) or dx = -f(x)/f'(x).
    
      So we obtain x(k+1) = x(k) - f(x(k))/f'(x(k)).
    
      To illustrate Newton's method, we draw the tangent line at x(k)
      and mark x(k+1) where the tangent meets the horizontal x-axis.
      See the solution handout for the plot.
    
                                                            +--------+
                                                            |    /15 |
                                                            +--------+
    
  3. Below is the plot of g(x) = (1.6 x)^(1/2). Starting at x(0) = 0.3, illustrate on the plot below how to produce three more points defined by x(k+1) = g(x(k)), k=0,1,...

    click to see the plot
    See the solution handout for the answer.

                                                            +--------+
                                                            |    /15 |
                                                            +--------+
    
  4. Consider f(x) = x^2 - 1.4 x + 0.24 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.

      click to see the graph
      See the solution handout for the answer.

    2. Write the values for x1, x2, f(x1), and f(x2) (4 decimal places, scientific notation):
      +-------+------------+------------+------------+------------+
      | step  |     x1     |     x2     |    f(x1)   |    f(x2)   |
      +-------+------------+------------+------------+------------+
      |   0   |  3.820E-1  |  6.180E-1  | -1.489E-1  | -2.433E-1  |
      |   1   |  6.180E-1  |  7.639E-1  | -2.433E-1  | -2.459E-1  |
      |   2   |  7.639E-1  |  8.541E-1  | -2.459E-1  | -2.263E-1  |
      +-------+------------+------------+------------+------------+
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  5. Consider
                 [ -1.213E-01  -3.148E-01   6.446E-01  ]
             A = [ -1.111E+00  -5.082E-01   2.092E-01  ].
                 [ -2.098E-01  -2.774E+00   4.738E-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.
                 [ -1.111E+00  -5.082E-01   2.092E-01  ] 2
        A -----> [ -1.213E-01  -3.148E-01   6.446E-01  ] 1
                 [ -2.098E-01  -2.774E+00   4.738E-01  ] 3
      
                  .1213      [                                     ]
       R2 := R2 - ------ R1  [ -1.111E+00  -5.082E-01   2.092E-01  ] 2
                  1.111      [                                     ]
       --------------------> [  1.092E-01  -2.593E-01   6.218E-01  ] 1
                  .2098      [                                     ]
       R3 := R3 - ------ R1  [  1.888E-01  -2.678E+00   4.343E-01  ] 3
                  1.111      [                                     ]
      
                             [ -1.111E+00  -5.082E-01   2.092E-01  ] 2
       --------------------> [  1.888E-01  -2.678E+00   4.343E-01  ] 3
                             [  1.092E-01  -2.593E-01   6.218E-01  ] 1
      
                  .2593      [                                     ]
       R3 := R3 - ------ R2  [ -1.111E+00  -5.082E-01   2.092E-01  ] 2
                  2.678      [                                     ]
       --------------------> [  1.888E-01  -2.678E+00   4.343E-01  ] 3
                             [                                     ]
                             [  1.092E-01   9.683E-02   5.797E-01  ] 1
                             [                                     ]
      
           [ 0 1 0 ]         [     1           0           0       ]
       P = [ 0 0 1 ]     L = [  1.888E-01      1           0       ]
           [ 1 0 0 ]         [  1.092E-01   9.683E-02      1       ]
      
                             [ -1.111E+00  -5.082E-01   2.092E-01  ]
                         U = [     0       -2.678E+00   4.343E-01  ]
                             [     0           0        5.797E-01  ]
      
    2. What is the determinant of A?
        det(A) = det(P*L*U)
               = det(P)*det(L)*det(U)
               = (+1)*(+1)*(-1.111E+00)*(-2.678E+00)*(5.797E-01)
               = +1.725E+00
      
                                                            +--------+
                                                            |    /30 |
                                                            +--------+