Answer to Quiz 11 Fri 18 Nov 2005

  1. The formula
                     h  (                            )
    y(n+1) = y(n) + --- (- f(n-1) + 8 f(n) + 5 f(n+1))
                     12 (                            )
    
    is used to solve dy/dx = f(x,y(x)).
    Use the method of undetermined coefficients to derive this formula.

    Answer:

       Without loss of generality, we consider x(n) = 0,
       then x(n-1) = -h and x(n+1) = +h.
    
        h
       /
       | f(x,y(x)) dx = c(-1) f(-h) + c(0) f(0) + c(+1) f(+h)
       /
        0
    
    With three unknown coefficients, we can require that the first
    three basis functions 1, x, and x^2 are integrated exactly:
    
           h
          /
    f=1   | 1 dx =  h  = c(-1)      + c(0)   + c(+1) 
          /
          0
    
          h          2
          /         h
    f=x   | x dx = --- = c(-1) (-h) + c(0) 0 + c(+1) (+h)
          /         2
          0
    
           h         3
       2  /  2      h              2                     2
    f=x   | x dx = --- = c(-1) (-h) + c(0) 0 + c(+1) (+h)
          /         3
          0
    
    The last two equations are  -c(-1) + c(1) = h/2
                                 c(-1) + c(1) = h/3
    
    Adding these two equations leads to c(1) = 5*h/12, and
    with further elimination we find c(-1) = -h/12, c(0) = 8*h/12.
    
    
  2. Suppose we want to solve an initial-value problem y' = f(x,y), y(0) = y_0, with a predictor-corrector method using four points in each step. Calculate how many times we evaluate f to approximate y(1.4), using step size h = 0.2.
    Justify your count.

    Answer:

    With a fixed step size of h = 0.2, we compute y(7) at x = 1.4:
    
            4  +  4  +  4  +  1  +  1  +  1  +  1   = 16 function evaluations
     y(0)  y(1)  y(2)  y(3)  y(4)  y(5)  y(6)  y(7)
    --+-----+-----+-----+-----+-----+-----+-----+------------
     0.0   0.2   0.4   0.6   0.8   1.0   1.2   1.4
           RK    RK    RK    PC    PC    PC    PC
    
    The predictor needs 4 points, which are computed by a Runge-Kutta method.
    Since the order of the Runge-Kutta method must match the order of the
    predictor-corrector method, it must use the same number of function
    evaluations, i.e.: 4 in each step.
    
    Note that function evaluations are stored.  With a fixed step size,
    a predictor-corrector method needs only one new function evaluation
    in each step.