ODE system.

Population of  one  species: e.g. Rabbits:
 
  •   Paradisal Condition:     y'(t) = a y(t).

  •   It may be valid for a short period, the solution approaches infinity as t approaches infinity.
     
  •   Add death rate:     y'(t) = a y(t) - b y(t) = (a-b) y(t).

  •    It  will valishes if b>a, and approaches to infinity if a>b; and remains as a constant if a=b.

       Better model:   y'(t) = a y(t) - b y(t) 2.
     

    Population of  two species: Predator and Prey model, e.g Rabbits and Fox
     
  •  y'(t) = a y(t) - b y(t) z(t)

  •  z'(t) = - c z(t) + d y(t) z(t).
     
    Transfer high order IVP to first order system.
     
    y'''(t) - 2 y''(t) + t y'(t) + 2 y = 0,      y(0) = 0,   y'(0)=1,    y''(0)=0.
     
    Define:
    y1 = y,
    y2 = y'
    y3 = y''.
     
    Then:
    y1 ' = y2,
    y2' = y'' = y3,
    y3' = y''' = 2 y'' - t y' - 2 y = 2 y3 - t y2 - 2 y1
    y1 (0) = y(0) = 0;   y2(0) = y'(0) = 1;   y3(0) = y''(0) = 0.


     ODE system II

  •    Format for defining an ODE system:
  •   Runge-Kutta Methods:       One step multi-stage method.


                  Motivations:
  • Very popular and useful
  • More accurate,    h2, hh4 .,....
  • Adaptive time steps,  different  h.
  • More stable (later)

  •  
    Key idea:                    y' = f(x,y);  y(x0) = y0;                It is equivalent  to:

                      y(x) =  y0+ int   f(t, y(t))   from    x0    to    x .

    From one step to the next,  find  better approximation to the integral.

    Try different strategies of integration we get different RK methods.

    Examples:    Left  rectangle,  Mid-rectangle,  Right rectangle,   Trapezoidal .....  (class exercise)
     

           Summary of Runge-Kutta method
    Steps:  (three groups of coefficients) How to determine the coefficients:
           Remarks:
  • Generally, RK(k) method is k-th order accurate, which means that the error is propotional to hk.

  •  
  •  High order methods require more function evaluations (f(x,t)). Therefore if the function is easy to compute, high order methods are more efficient. If the function is too complicated and take too much time to evaluate, then the lower order method such as Euler's method may be more efficient.
  • Format calling ODE45 (RK(4) + RK(5),  and adaptive time step):

              [x, y] = ode45('yfun',[x0, xfinal] ,y0)

    Comparison of different method for the following problem:

        y1' = -y2,
        y2 ' =  y1
        y1(0) = 1;  y2(0) = 0.
    The exact solution is   y1= cos (x),    y2  =  sin (x),     y1 + y2 ' =  1, so phase plot   plot(y1,y2) is a circle.