Answers to Exam 1(a) 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 -11 and +11.
    1. What is the smallest positive floating-point number?
      Answer:
               +.1000E-11 = 10^(-12)
      
    2. What is the result of 407.1 + 2.657 in this number system?
      Answer:
               407.1 = +.4071E+3
               2.657 = +.2657E+1 = +.002657E+3
      
                +.4071E+3
                +.002657E+3
               -------------
                +.409757E+3 = +.4098E+3 = 409.8
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    

  2. Below is the plot of g(x) = 2 sin(x). Starting at x(0) = 3, 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. Consider the nonlinear equation f(x) = 0. Show that the order of Newton's method is at least two, provided the derivative f' is nonzero at the root.
    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
    
      At the root r, f(r) = 0 and f'(r) /= 0:
    
                         [f'(r)]^2
           g'(r) = 1 -  ----------- = 0
                         [f'(r)]^2
    
    
                                                            +--------+
                                                            |    /15 |
                                                            +--------+
    
  4. Consider f(x) = x^2 + 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] = [0.00E+0,6.18E-1]
            [a2,b2] = [2.36E-1,6.18E-1]
            [a3,b3] = [5.28E-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 |  6.830E-1 |  5.603E-1  |
         |    1   |  6.180E-1 |  7.639E-1 |  5.603E-1 |  5.818E-1  |
         |    2   |  5.279E-1 |  6.180E-1 |  5.959E-1 |  5.603E-1  |
         +--------+-----------+-----------+-----------+------------+
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  5. Consider
                 [  1.904E-01   8.174E-01   9.799E-01  ]
             A = [  6.207E-01   8.729E-01   4.415E-01  ]
                 [  4.511E-01   3.919E-01   8.609E-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:
                                 [  6.207E-1    8.729E-1    4.415E-1  ] 2
        A  ------------------->  [  1.904E-1    8.174E-1    9.799E-1  ] 1
                                 [  4.511E-1    3.919E-1    8.609E-1  ] 3
                   1.904 
       R2 := R2 - ------- R1
                   6.207         [  6.207E-1    8.729E-1    4.415E-1  ] 2
      ------------------------>  [  3.068E-1    5.496E-1    8.444E-1  ] 1
                   4.511         [  7.268E-1   -2.425E-1    5.400E-1  ] 3
       R3 := R3 - ------- R1     
                   6.207         
      
                  -2.425
       R3 := R3 - ------- R2
                   5.496         [  6.207E-1    8.729E-1    4.415E-1  ] 2
      ------------------------>  [  3.068E-1    5.496E-1    8.444E-1  ] 1
                                 [  7.268E-1   -4.412E-1    9.125E-1  ] 3
      
      
              [ 0 1 0 ]          [  1.000E+0    0.000E+0    0.000E+0  ]
          P = [ 1 0 0 ]      L = [  3.068E-1    1.000E+0    0.000E+0  ]
              [ 0 0 1 ]          [  7.268E-1   -4.412E-1    1.000E+0  ]
      
                                 [  6.207E-1    8.729E-1    4.415E-1  ]
                             U = [  0.000E+0    5.496E-1    8.444E-1  ]
                                 [  0.000E+0    0.000e+0    9.125E-1  ]
      
    2. What is the determinant of A?
      Answer:
            det(A) = det(P L U)
                   = det(P)*det(L)*det(U)
                   = (-1)*1*(6.207E-1)*(5.496E-1)*(9.125E-1)
                   = -3.113E-1
      
                                                            +--------+
                                                            |    /30 |
                                                            +--------+