Exam 2(a) Mon 1 Apr 2002

  1. Consider the polynomial p(x) = x^2 + 2x - 3.

    1. Construct the Newton form of p(x) by divided differences, using the points (x_i,p(x_i)), with x_i = i, for i=0,1,2,3.

    2. Explain why the last element f_0123 in the table of divided differences you constructed above is (or should have been) zero.

    Answers:

    1.       0  -3
                    0-(-3)
                    ------ = 3 
                    1 - 0
                                    4-3
            1   0                  ----- = 1
                    5-(-3)          2-1
                    ------ = 4                   1-1
                    2 - 0                       ----- = 0
                                    5-3          3-2
            2   5                  ----- = 1
                   12-(-3)          3-1
                   ------- = 5
                    3 - 0
      
            3  12
      
      The Newton form is
            -3 + 3*(x-0) + 1*(x-0)*(x-1) + 0*(x-0)*(x-1)*(x-2).
      

    2. The interpolation problem has a unique solution. If f_0123 would not be zero, then two interpolating polynomials would exists: one of degree three and one of degree two (p itself). This is impossible, therefore f_0123 must be zero.
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  2. The Maclaurin expansion of x/sqrt(x+1) is
    
               2        3         4   35   5   63   6   231   7   429   8 
      x - 1/2 x  + 3/8 x  - 5/16 x  + --- x  - --- x  + ---- x  - ---- x 
                                      128      256      1024      2048   
    
        6435    9      10
      + -----  x  + O(x  )
        32768
    
    
    Use this Maclaurin expansion to construct a Padé approximation for x/sqrt(x+1) as a quotient of two quadrics.

    Answer:

                                2                   2
                a0 + a1 x + a2 x           x + 1/2 x 
        R(x) = ------------------- =  ----------------
                                2                   2
                 1 + b1 x + b2 x       1 + x + 1/8 x
    
    
    where the coefficients are computed as follows:
    
     (                  3         4 ) (                2 )
     ( x - 1/2 x + 3/8 x  - 5/16 x  )*( 1 + b1 x + b2 x  )
     (                              ) (                  )
    
                         2
       - a0 - a1 x - a2 x  = 0
    
    Elaborating the product gives:
                2        3
       x +  b1 x +   b2 x
                2        3          4
         - 1/2 x - b1/2 x -   b2/2 x
                         3          4 
                 +  3/8 x + 3 b1/8 x  + ...
                                    4
                           -  5/16 x  + ...
                         2
       - a0 - a1 x - a2 x  = 0
    
    which gives rise to the system
       0 - a0 = 0
       1 - a1 = 0
       b1 - 1/2 - a2 = 0
       b2 - b1/2 + 3/8 = 0
       -b2/2 + 3/8 b1 - 5/16 = 0
    
    Solving the system first for b1 and b2, and then for a0,a1, and a2, gives the coefficients of the Padé approximation.
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  3. Give the continued-fraction representation for x/(2 x^2 - 5).

    Answer:

         2
      2 x  - 5  =  2 x x - 5
    
    
          x             1              1
      ---------- = ------------ = -----------
          2             2                 5
       2 x  - 5      2 x  - 5      2 x - ---
                    ----------            x
                         x
    
                                                            +--------+
                                                            |    /10 |
                                                            +--------+
    
  4. Use central differences and Richardson extrapolation to compute a sixth order approximation for the derivative of arctan(x) at x = 0.4.

    1. Start with h=0.1 and divide h by 2 (i.e.: r = 1/2) to build the first column of the extrapolation table. Show how you applied the formulas (for partial credit). Write your answers with ten decimal places.

    2. How many decimal places are correct in your final answer from Richardson extrapolation? Explain.

    Answers:

    1. 
         arctan(0.5) - arctan(0.3)
        ---------------------------     = 8.609 540 726 E-1
                    0.2                                     \
                                                              (a)
         arctan(0.45) - arctan(0.35)                        /
        -----------------------------   = 8.617 910 675 E-1
                     0.1                                    \
                                                              (b)
         arctan(0.425) - arctan(0.375)                      /
        ------------------------------- = 8.619 995 434 E-1
                      0.05
      
               8.617 910 675 E-1 * 4 - 8.609 540 726 E-1
        (a) : ------------------------------------------- = 8.620 700 658 E-1
                                   4 - 1
      
               8.619 995 434 E-1 * 4 - 8.617 910 675 E-1 
        (b) : ------------------------------------------- = 8.620 690 354 E-1
                                   4 - 1
      
         8.620 690 354 E-1 * 16 - 8.620 700 658 E-1 
        -------------------------------------------- = 8.620 689 667 E-1
                             16 - 1
      

    2. Comparing two consecutive approximations, we see that the numbers match at seven decimal places. More precisely, the error is O(h^6) with h = (1/40)^6 which is approximately 2.4 E-10, so we should have about 9 decimal places right.
                                                            +--------+
                                                            |    /25 |
                                                            +--------+
    
  5. Consider the quadrature rule
                  a
                 /                 ( -a )       ( a )
                |   f(x) dx  = w  f(----) + w  f(---)   for a > 0.
                /               1  ( 2  )    2  ( 2 )
                 -a
    
    Determine the weights w_1 and w_2 so that the rule has the highest possible algebraic degree of precision.

    Answer:

                  a
                 / 
                |   1 dx  = 2 a = w  + w
                /                  1    2
                 -a
    
                  a         
                 /                 ( -a )      ( a )
                |   x dx  = 0 = w  (----) + w  (---)
                /                1 ( 2  )    2 ( 2 )
                 -a
    
    The solution is
               w  =  a    w  =  a
                1          2
    
                                                            +--------+
                                                            |    /15 |
                                                            +--------+
    
  6. How would you compute a least squares approximation using Chebyshev polynomials? For example, suppose we have five samples (x_i,y_i), i=1,2,...,5. We wish to fit the data with a second degree polynomial p(x) = a_0 T_0(x) + a_1 T_1(x) + a_2 T_2(x). Describe how you would find the coefficients a_0, a_1, and a_2.

    Answer:

    We must solve

        [ y_1 ]   [ T_0(x_1)  T_1(x_1)  T_2(x_1) ] 
        [ y_2 ]   [ T_0(x_2)  T_1(x_2)  T_2(x_2) ] [ a_0 ] 
        [ y_3 ] = [ T_0(x_3)  T_1(x_3)  T_2(x_3) ] [ a_1 ]
        [ y_4 ]   [ T_0(x_4)  T_1(x_4)  T_2(x_4) ] [ a_2 ]
        [ y_5 ]   [ T_0(x_5)  T_1(x_5)  T_2(x_5) ] 
    
    or in matrix notation: Y = X a. To obtain a square system we multiply with the transpose of X and solve the normal equations:
            T       T
           X X a = X Y
    
                                                            +--------+
                                                            |    /10 |
                                                            +--------+