Answer to Quiz 2 Fri 2 Sep 2005

  1. Assume the floating-point arithmetic on our computer has base 10, with 4 decimal places in the fraction (or mantissa), and exponents ranging between -10 and +10.

    Show the evaluation of 98.31 + 0.4532 in this floating-point system.

    Answer:

           98.31 = +.9831 10^2        0.4532 = +.4532 10^0
        + 0.4532 = +.004532 10^2
       -------------------------
                   +.987632 10^2 = +.9876 10^2 = 98.76
    
  2. Consider f(x) = x^2 - x - 2 = 0. Take x(0) = 0 and x(1) = 3 to start the secant method.
    1. Show how x(2) and x(3) are computed on the plot below:

      Answer:

      The plot below shows the two tangent lines, the first on in blue,
      the second one in black.  The points x(2) and x(3) are where the
      tangent lines meet the horizontal x-axis.
      
      
      Notice that, if x(0) = 3 and x(1) = 0, the secant method would not
      allow the computation of x(3).  For x(0) = 3 and x(1) = 0, the
      method of regula falsi must be used.
      
    2. Execute the secant method as x(k+2) = x(k+1) + Delta x. Complete the table below with numbers in scientific notation using rounding to 4 decimal places.

      Answer:

      +------+-----------+-----------+-----------+-----------+-----------+
      |      |           |           |           |           |           |
      | k    |    x(k)   |   x(k+1)  |  Delta x  |   x(k+2)  | f(x(k+2)) |
      |      |           |           |           |           |           |
      +======+===========+===========+===========+===========+===========+
      |   0  |  0.000E+0 |  3.000E+0 | -2.000E+0 |  1.000E+0 | -2.000E+0 |
      |   1  | -3.000E+0 |  1.000E+0 |  6.667E-1 |  1.667E+0 | -8.881E-1 |
      |   2  |  1.000E+0 |  1.667E+0 |  5.327E-1 |  2.200E+0 |  6.400E-1 |
      +------+-----------+-----------+-----------+-----------+-----------+