Answer to Quiz 7 Fri 4 Mar 2005

  1. Consider (0,e^0), (1,e^1), (2,e^2) as given interpolation data.
    Give the polynomial interpolating through these 3 points in the form of Lagrange. Evaluate this form at 1.5.

    Answer:

              (x-1)*(x-2)       (x-0)*(x-2)       (x-0)*(x-1)
       p(x) = ----------- e^0 + ----------- e^1 + ----------- e^2
              (0-1)*(0-2)       (1-0)*(1-2)       (2-0)*(2-1)
    
              1 1     1         1  3     1       1 3 1
            = - - (-1)- e^0 + ---- - (-1)- e^1 + - - - e^2
    	  2 2     2       (-1) 2     2       2 2 2
    
                1   3     3
            = - - + - e + - e^2  is approximately 4.685E+0
    	    8   4     8
    

  2. Set up the linear system for the natural spline for sin(x) over [0,pi], using 4 intervals of equal length. Do not solve the system.

    Answer:

       We divide [0,pi] in 4 equal subintervals: h = pi/4.  
    
       The unknowns in the linear system are S1,S2,S3,
       as S0 = 0 and S4 = 0 for a natural spline.
    
       [ pi     pi/4   0    ] [ S1 ]     [ sin[pi/4,pi/2]   - sin[0,pi/4]      ]
       [ pi/4   pi     pi/4 ] [ S2 ] = 6 [ sin[pi/2,3*pi/4] - sin[pi/4,pi/2]   ]
       [  0     pi/4   pi   ] [ S3 ]     [ sin[3*pi/4,pi]   - sin[pi/2,3*pi/4] ]
    
                           sin(pi/4) - sin(0)          4  ( sqrt(2)     )
       sin[0,pi/4]      = --------------------      = --- ( ------- - 0 )
                               pi/4  -  0              pi (    2        )
    
                           sin(pi/2) - sin(pi/4)       4  (     sqrt(2) )
       sin[pi/4,pi/2]   = -----------------------   = --- ( 1 - ------- )
                               pi/2  -  pi/4           pi (        2    )
    
                           sin(3*pi/4) - sin(pi/2)     4  ( sqrt(2)     )
       sin[pi/2,3*pi/4] = ------------------------- = --- ( ------- - 1 )
                               3*pi/4  -  pi/2         pi (    2        )
    
                           sin(pi) - sin(3*pi/4)       4  (     sqrt(2) )
       sin[3*pi/4,pi]   = -----------------------   = --- ( 0 - ------- )
                               pi  -  3*pi/4           pi (        2    )
    
       So the righthand side vector equals
    
          24  [ 1 - sqrt(2) ]
         ---- [ sqrt(2) - 2 ]
          pi  [ 1 - sqrt(2) ]