Answers to Exam 1(b) Wed 23 Feb 2005

  1. Suppose the basis of our floating-point numbers is ten and all numbers have a fraction (mantissa) of 4 decimal places long, with exponents ranging between -22 and +22.
    1. What is the smallest positive floating-point number?
      Answer:
              +.1000E-22 = 10^(-23)
      
    2. What is the result of 228.5 + 1.704 in this number system?
      Answer:
            228.5 = +.2285E+3
            1.704 = +.1704E+1 = +.001704E+1
      
             +.2285E+3
             +.001704E+1
            -------------
             +.230204E+3 = +.2302E+3 = 230.2
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    

  2. Below is the plot of g(x) = exp(0.25*x). Starting at x(0) = 8, illustrate on the plot below how to produce three more points defined by x(k+1) = g(x(k)), k=0,1,...


    Answer: See the handout on paper.

                                                            +--------+
                                                            |    /15 |
                                                            +--------+
    
  3. Show the convergence rate of Newton's method is (m-1)/m when applied to f(x) = (x-1)^m.
    Answer:
           x(k+1) = x(k) - f(x(k))/f'(x(k))
          => g(x) = x - f(x)/f'(x)
    
                        f'(x)f'(x) - f(x)f"(x)
           g'(x) = 1 - ------------------------
                              [ f'(x) ]^2
    
                        m^2(x-1)^(m-1)(x-1)^(m-1) - (x-1)^m m(m-1)(x-1)^(m-2)
                 = 1 - -------------------------------------------------------
                                   m^2 (x-1)^(m-1) (x-1)^(m-1)
    
                        m^2 - m^2 + m
                 = 1 - ---------------
                             m^2
    
                        1      m-1
                 = 1 - --- =  -----
                        m       m
    
                                                            +--------+
                                                            |    /15 |
                                                            +--------+
    
  4. Consider f(x) = x^4 + exp(-x) 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.


      Answer:

              [a1,b1] = [3.82E-1,1.00E+0]
              [a2,b2] = [3.82E-1,7.64E-1]
              [a3,b3] = [3.82E-1,6.18E-1]
      
    2. Write the values for x1, x2, f(x1), and f(x2) (4 decimal places, scientific notation):
      Answer:
         +--------+-----------+-----------+-----------+------------+
         |  step  |    x1     |     x2    |   f(x1)   |   f(x2)    |
         +========+===========+===========+===========+============+
         |    0   |  3.820E-1 |  6.180E-1 |  7.038E-1 |  6.849E-1  |
         |    1   |  6.180E-1 |  7.639E-1 |  6.849E-1 |  8.064E-1  |
         |    2   |  5.279E-1 |  6.180E-1 |  6.675E-1 |  6.849E-1  |
         +--------+-----------+-----------+-----------+------------+
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  5. Consider
                 [  5.041E-01   2.143E-01   7.506E-01  ]
             A = [  6.483E-01   5.604E-01   8.562E-01  ]
                 [  9.167E-01   2.797E-01   9.629E-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:
                                 [  9.167E-1    2.797E-1    9.629E-1  ] 3
        A  ------------------->  [  6.483E-1    5.604E-1    8.562E-1  ] 2
                                 [  5.041E-1    2.143E-1    7.506E-1  ] 1
                   6.483
       R2 := R2 - ------- R1
                   9.167         [  9.167E-1    2.797E-1    9.629E-1  ] 3
      ------------------------>  [  7.072E-1    3.626E-1    1.752E-1  ] 2
                   5.041         [  5.499E-1    6.050E-2    2.211E-1  ] 1
       R3 := R3 - ------- R1     
                   9.167         
      
                  0.6050
       R3 := R3 - ------- R2
                   3.626         [  9.167E-1    2.797E-1    9.629E-1  ] 3
      ------------------------>  [  7.072E-1    3.626E-1    1.752E-1  ] 2
                                 [  5.499E-1    1.669E-1    1.919E-1  ] 1
      
      
              [ 0 0 1 ]          [  1.000E+0    0.000E+0    0.000E+0  ]
          P = [ 0 1 0 ]      L = [  7.072E-1    1.000E+0    0.000E+0  ]
              [ 1 0 0 ]          [  5.499E-1    1.669E-1    1.000E+0  ]
      
                                 [  9.167E-1    2.797E-1    9.629E-1  ]
                             U = [  0.000E+0    3.626E-1    1.752E-1  ]
                                 [  0.000E+0    0.000e+0    1.919E-1  ]
      
    2. What is the determinant of A?
      Answer:
               det(A) = det(P L U)
                      = det(P)*det(L)*det(U)
                      = (-1)*1*(9.167E-1)*(3.626E-1)*(1.919E-1)
                      = -6.379E-2
      
                                                            +--------+
                                                            |    /30 |
                                                            +--------+