Answers to Exam 2(b) Wed 6 Apr 2005

    1. Consider f(x) = x^(1/2). Our input data consists of three pairs: 4,2), (9,3), and (25,5). Apply Neville interpolation on this data for the value of the interpolating polynomial at x = 10.
    2. For n+1 interpolation points, what is the order (expressed in n) of the number of arithmetical operations required by Neville interpolation? Justify your estimate.
    1. 
        4  2
              (10- 9)*2 - (10-4)*3   16             16          50
              -------------------- = --     (10-25)*-- - (10-4)*--
                      4 - 9           5              5          16    89
        9  3                                ----------------------- = --
              (10-25)*3 - (10-9)*5   50              4 - 25            7
              -------------------- = --
                      9 - 25         16
       25  5
      
    2.   The algorithm proceeds in a double loop:
          for i from 1 to n do
             for j from 1 to i do
                4 subtractions, 2 multiplications, and 1 division.
        The total operation count is 7*n*(n+1)/2 = O(n^2).
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  1. Consider the Maclaurin expansion of f(x) = c^x, for some constant c:
     
                               2  2            3  3             4  4
        1 + ln(c) x + 1/2 ln(c)  x  + 1/6 ln(c)  x  + 1/24 ln(c)  x  
    
                       5  5      6
          + 1/120 ln(c)  x  + O(x )
    
    Set up the system of linear equations which must be solved to construct a Padé approximation of f as a quotient of two quadrics. Do NOT solve the system.
      Denote L = ln(c).
    
      0 = (1+x*L+x^2*L^2/2+x^3*L^3/6+x^4*L^4/24)*(1+b1*x+b2*x^2)
        - (a0+a1*x+a2*x^2)
    
       1 : 1 - a0 = 0
       x : b1 + L - a1 = 0
     x^2 : b2 + b1*L + L^2/2 - a2 = 0
     x^3 : b1*L^2/2 + b2*L + L^3/6 = 0
     x^4 : b1*L^3/6 + b2*L^2/2 + L^4/24 = 0
    
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  2. Give an argument to show that the Fourier series
                        n
                1      ---
         p(t) = - a  + >     a  sin(k*pi*t) + b cos(k*pi*t)
                2  0   ---    k                k
                       k=1
    
    approximates f(t) over t in [-1,+1] in the least squares sense.
       The residual r = p - f is perpendicular to the basis:
    
       <r,sin(n*pi*t)> = <p,sin(n*pi*t)> - <f,sin(n*pi*t)>
    
                       = a  - <f,sin(n*pi*t)>
                          n 
    
                       = 0
    
       The same holds for cos(n*pi*t).
    
       So if the residual r is orthogonal to the basis, 
       we have a least squares approximation.
    
    
                                                            +--------+
                                                            |    /15 |
                                                            +--------+
    
  3. Consider the values in the table below:
    +----------------------------------------------------------------------------------------------+
    |  x | .000000 | .125000 | .250000 | .375000 | .500000 | .625000 | .750000 | .875000 | 1.00000 |
    +----------------------------------------------------------------------------------------------+
    |f(x)| 1.00000 | .992198 | .968912 | .930508 | .877583 | .810963 | .731689 | .640997 | .540302 |
    +----------------------------------------------------------------------------------------------+
    
    Perform all your calculations with six significant decimal places.
    1. To approximate f'(0.5), compute central differences delta f(0.5,h), for h=.5,.25,.125.
    2. Apply extrapolation using the values for \delta f(0.5,h).
    3. How accurate is your final approximation for f'(0.5)?
    1.                      .540302 - 1.00000
        delta f(0.5,0.0) = ----------------- = -.459698
                                   1
      
                            .731689 - .968912
        delta f(0.5,0.25) = ----------------- = -.474446
                                   .5
      
                             .810963 - .930508
        delta f(0.5,0.125) = ----------------- = -.478180
                                    .25
      
    2.   -.459698
                  -.459698*(1/2)^2 - (-.474446)
                  ----------------------------- = -.479362
                           (1/2)^2 - 1                      -.479362*(1/2)^4 - (-.479425)
        -.474446                                            ----------------------------- = -.479429
                  -.474446*(1/2)^2 - (-.478180)                      (1/2)^4 - 1
                  ----------------------------- = -.479425
                           (1/2)^2 - 1           
        -.478180
      
      
    3.    (.125)^6 = 3.8E-6 => about 5 decimal places are correct.
         Also, see the number of corresponding digits
         in the last two approximations.
      
                                                            +--------+
                                                            |    /30 |
                                                            +--------+
    
  4. Consider the quadrature rule
            b
            /
            | f(x) dx = w0 f(x0) + w1 f(x1)
            /
            a
    
    1. Set up the system of equations in the weights w0, w1 and nodes x0, x1 to be satisfied for the highest possible algebraic degree of accuracy. Do NOT solve this system.
    2. What is the algebraic degree of accuracy attained by this rule?
    1.         b
              /
         f=1: | 1 dx   = b-a         = w0 + w1
              /
      	a
      
              b
              /
         f=x: | x dx   = (b^2-a^2)/2 = w0*x0 + w1*x1
              /
      
              b
              /
       f=x^2: | x^2 dx = (b^3-a^3)/3 = w0*x0^2+ w1*x1^2
              /
      
              b
              /
       f=x^3: | x^3 dx = (b^4-a^4)/4 = w0*x0^3+ w1*x1^3
              /
              a
      
    2. The algebraic degree of accuracy attained by this rule is 3.
                                                            +--------+
                                                            |    /15 |
                                                            +--------+