Answer to Quiz 10 Fri 11 Nov 2005

  1. Consider the initial value problem dy/dx = -y, y(0) = 1.
    Apply the method of Euler to approximate y(0.4), using h = 0.1.

    Answer:

    Euler's method: y(n+1) = y(n) + h*f(x(n),y(n))
                           = y(n) + h*(-y(n))
                           = (1 - h)*y(n)
    
     => y(n+1) = (1-h)^(n+1)*y(0)
    
    So y(4) = (1-h)^4 = 6.561E-1.
    
  2. Consider the initial value problem dy/dx = lambda*y, y(0) = 1, with parameter lambda.
    Describe the difference in accuracy of the method of Euler for various values of lambda.
    In particular, what is the difference between lambda = +1 and lambda = -1?

    Answer:

      lambda = -1: y(n) = (1-h)^n  y(x) = exp(-x)
      lambda = +1: y(n) = (1+h)^n  y(x) = exp(+x)
    
    The error at x = 1, for h = 0.1 is
    
      lambda = -1: |exp(-1) - (0.9)^10| = 1.9E-2
      lambda = +1: |exp(+1) - (1.1)^10| = 1.2E-1
    
    Euler's method is more accurate for lambda < 0.
    As the exact solution goes to zero as x goes to infinity,
    so does the approximation y(n) and the error.