Answers to Exam 1(a) Wed 20 Feb 2002

  1. Consider the representation of floating-point numbers with base 10 and 2 digits in the fraction part. The values for the exponents are between -10 and +10.

    1. What is the machine precision in this number system?

      Answer:

             B^(-p) = 10^(-2)
      

    2. Represent the numbers 17 and 333 as floating point numbers and illustrate the calculation of 17+333, using rounding. What is the calculated sum?

      Answer:

             17 = +.17 10^2
            333 = +.33 10^3
      
      denormalize 17 and round:
      
             17 = +.02 10^3
            333 = +.33 10^3
                ------------
                  +.35 10^3
      
      The calculated sum is 350.
      
                                                            +--------+
                                                            |    /15 |
                                                            +--------+
    

  2. Below make the plot of g(x) = 10/(x-3). Starting at x_0 = 4, illustrate on the plot below how to produce four more points defined by x(k+1) = g(x(k)), k=0,1,...

    Answer: Follow the link for the cobweb picture.

    Compute the convergence rate of this fixed-point iteration

    1. for x=-2:

      Answer:

             g(x) = 10*(x-3)^(-1)
             g'(x) = -10*(x-3)^(-2)
             g'(-2) = -10/5^2 = -2/5
      

    2. for x=5:

      Answer:

             g'(5) = -10/2^2 = -5/2
      

    What conclusions can you make from the rates you computed above?

    Answer:

           |g'(-2)| < 1 : linear convergence
           |g'(5)| > 1 : divergence
    
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    

  3. Apply 3 steps of the golden section search method to find the minimum of the function f(x) = x^2 - 3x in the interval [0,5].

    Write the values for a, b, x_1, x_2, f(x_1), and f(x_2) in the table (4 decimal places):

    Answer:

    +------+---------+---------+---------+---------+----------+----------+
    | step |    a    |    b    |   x_1   |   x_2   |  f(x_1)  |  f(x_2)  |
    +------+---------+---------+---------+---------+----------+----------+
    |   0  |   0.000 |   5.000 |  1.910  |  3.090  |  -2.082  |  0.2781  |
    |   1  |   0.000 |   3.090 |  1.180  |  1.910  |  -2.148  |  -2.082  |
    |   2  |   0.000 |   1.910 |  0.7296 |  1.180  |  -1.656  |  -2.148  |
    +------+---------+---------+---------+---------+----------+----------+
    
                                                            +--------+
                                                            |    /15 |
                                                            +--------+
    

  4. Consider the matrix
               [  4.447E-01   7.919E+08  ]
           A = [                         ]
               [  6.154E-01   9.218E-01  ]
    
     with its inverse
    
               [ -1.891E-09   1.625E+00  ]
      A^(-1) = [                         ].
               [  1.263E-09  -9.124E-10  ]
    
    

    1. Compute the condition number of A using the norm ||.||_1.

      Answer:

             ||A||_1 = 7.919E+8 + 9.218E-1 = 7.919E+8
      
             ||A^(-1)||_1 = 1.625E+0 + |-9.124E-10| = 1.625E+0
      
             cond(A) = ||A||_1*||A^(-1)||_1 = 1.287E+9
      

    2. Suppose we wish to solve the system A x = b, using the matrix A from above. Assuming a relative error of 10^(-16) on the coefficients of the matrix, what is the bound on the relative error of the solution?

      Answer:

             ||x - xx||
             ----------  <= cond(A)*10^(-16) = 1.287E+9 * 10^(-16)
                ||x||                        = 1.287E-7
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    

  5. Consider the matrix
              [   2.000     8.000     0.000   ]
          A = [   9.000     4.000     4.000   ].
              [   6.000     7.000     8.000   ]
    

    1. Compute the LU decomposition of A with partial pivoting.

      Calculate with four decimal places, using rounding: write the answer of every step rounded to four decimal places, and use the rounded number in the calculations of the next step.

      Answer:

                                        [   9.000     4.000     4.000   ] 2
            A  ---------------------->  [   2.000     8.000     0.000   ] 1
                                        [   6.000     7.000     8.000   ] 3
      
      
                 R2 = R2 - (2/9)*R1     [   9.000     4.000     4.000   ] 2  
               ---------------------->  [   0.2222    7.111    -0.8889  ] 1
                 R3 = R3 - (6/9)*R1     [   0.6667    4.333     5.333   ] 3
      
      
                 R3 = R3 - 4.333/7.111*R2     [   9.000     4.000     4.000   ] 2  
               ---------------------------->  [   0.2222    7.111    -0.8889  ] 1
                                              [   0.6667    6.093     5.875   ] 3
      
      

    2. What is the determinant of A?

      Answer:

              det(A) = det(P*L*U)
                     = det(P)*det(L)*det(U)
                     = (-1)*1*(-9.000)*7.111*5.875
                     = -376.0
      
                                                            +--------+
                                                            |    /30 |
                                                            +--------+