Answers to Exam 1(a) 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 -7 and +8.
    1. What is the smallest positive floating-point number in this number system?
          .10000E-7 = 10^(-8)
      
    2. What is the result of 12.381 + 0.098321 in this number system?
          12.381 = +.12381E+2
          0.098321 = +.98321E-1 = +.00098321E+2 (denormalize)
      
          +.12381E+2
          +.00098321E+2
         ---------------
          +.12479321E+2 = +.12479E+2 = 12.479
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  2. Derive the formula for the method of Aitken to accelerate the sequence x(k), k=0,1,...
    Illustrate the working of Aitken acceleration with a plot.
       Denote e(x(k)) = x(k+1) - x(k) and e(x(k+1)) = x(k+2) - x(k+1).
       The application of the secant method on e(x) = 0 gives a(k):
    
                           x(k+1) - x(k)
       a(k) = x(k+1) - --------------------- e(x(k))
                        e(x(k+1)) - e(x(k))
    
                           (x(k+1) - x(k))^2
            = x(k+1) - -------------------------- 
                        x(k+2) - 2*x(k+1) + x(k)
    
       To illustrate Aitken's method, we plot the execution of one step
       of the secant method on e(x) = 0.  See the solution handout.
    
                                                            +--------+
                                                            |    /15 |
                                                            +--------+
    
  3. Below is the plot of g(x) = 0.4x^2 + 0.2x - 1.2. Starting at x(0) = 2.8, illustrate on the plot below how to produce three more points defined by x(k+1) = g(x(k)), k=0,1,...

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

                                                            +--------+
                                                            |    /15 |
                                                            +--------+
    
  4. Consider f(x) = x^2 - 1.1 x + 0.18 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 here 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  | -9.427E-2  | -1.179E-1  |
      |   1   |  6.180E-1  |  7.639E-1  | -1.179E-1  | -7.673E-2  |
      |   2   |  5.279E-1  |  6.180E-1  | -1.220E-1  | -1.179E-1  |
      +-------+------------+------------+------------+------------+
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  5. Consider
                 [ -1.357E-01   6.112E-01   1.365E+00  ]
             A = [  8.797E-01   9.792E-01  -8.069E-01  ].
                 [ -2.263E-01  -1.160E+00   1.126E+00  ]
    
    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.
                [  8.797E-01   9.792E-01  -8.069E-01  ] 2
        A ----> [ -1.357E-01   6.112E-01   1.365E+00  ] 1
                [ -2.263E-01  -1.160E+00   1.126E+00  ] 3
      
                  -.1357       [                                     ]
       R2 := R2 - ------- R1   [  8.797E-01   9.792E-01  -8.069E-01  ] 2
                   .8797       [                                     ]
       ----------------------> [ -1.543E-01   7.623E-01   1.240E+00  ] 1
                  -.2263       [                                     ]
       R3 := R3 - ------- R1   [ -2.572E-01  -9.081E-01   9.185E-01  ] 3
                   .8797       [                                     ]
      
                               [  8.797E-01   9.792E-01  -8.069E-01  ] 2
       ----------------------> [ -2.572E-01  -9.081E-01   9.185E-01  ] 3
                               [ -1.543E-01   7.623E-01   1.240E+00  ] 1
      
                   .7623       [                                     ]
       R3 := R3 - ------- R2   [  8.797E-01   9.792E-01  -8.069E-01  ] 2
                  -.9081       [                                     ]
       ----------------------> [ -2.572E-01  -9.081E-01   9.185E-01  ] 3
                               [                                     ]
                               [ -1.543E-01  -8.394E-01   2.011E+00  ] 1
                               [                                     ]
      
           [ 0 1 0 ]       [     1            0            0       ]
       P = [ 0 0 1 ]   L = [ -2.572E-01       1            0       ]
           [ 1 0 0 ]       [ -1.543E-01   -8.394E-01       1       ]
      
                           [  8.797E-01    9.792E-01   -8.069E-01  ]
                       U = [     0        -9.081E-01    9.185E-01  ]
                           [     0            0         2.011E+00  ]
      
    2. What is the determinant of A?
         det(A) = det(P*L*U)
                = det(P)*det(L)*det(U)
                = (+1)*(+1)*(8.797E-01)*(-9.081E-01)*(2.011E+00)
                = -1.606E+00
      
                                                            +--------+
                                                            |    /30 |
                                                            +--------+