Fourth Order
RK-Method
The most commonly used method is
Runge-Kutta fourth order method.
The fourth order RK-method is
                    1
       yi+1   = yi + (k1 + 2k2 + 2k3 + k4 ),
                    6
                                      Ordinary Differential Equations (ODE) – p.44/89
where
        k1 = hf (xi , yi ),
                          h    k1
                                    !
        k2 = hf xi + , yi +           ,
                          2     2
                          h    k2
                                    !
        k3 = hf xi + , yi +           ,
                          2     2
        k4 = hf (xi + h, yi + k3 ).
                                    Ordinary Differential Equations (ODE) – p.45/89
      Example 1
Find the approximate solution of the initial value
problem
                dx        x
                   =1+ , 1≤t≤3
                dt         t
with the initial condition
                     x(1) = 1,
using the Runge-Kutta second order and fourth
order with step size of h = 1.
                                     Ordinary Differential Equations (ODE) – p.46/89
       Solution
RK 2nd order method.    The formula is
                            h
               yi+1   = yi + (k1 + k2 ) ,
                            2
where k1 = f (xi , ti ), k2 = f (xi + h, ti + hk1 ).
Here, h = 1 and t0 = x0 = 1. Therefore,
                                              x0
                      k1 = f (t0 , x0 ) = 1 +     = 2,
                                               t0
                                              3
k2 = f (t0 + h, x0 + hk1 ) = f (2, 3) = 1 + = 2.5.
                                              2
                                            Ordinary Differential Equations (ODE) – p.47/89
Thus,
                     1
            y1 = 1 + (2 + 2.5) = 3.25.
                     2
Similary, we calculate y2 .
                                    Ordinary Differential Equations (ODE) – p.48/89
RK 4th order method.   The formula is
                     1
        yi+1   = yi + (k1 + 2k2 + 2k3 + k4 ),
                     6
where
           k1 = hf (ti , xi ),
                             h    k1
                                       !
           k2 = hf ti + , xi +           ,
                             2     2
                             h    k2
                                       !
           k3 = hf ti + , xi +           ,
                             2     2
           k4 = hf (ti + h, xi + k3 ).  Ordinary Differential Equations (ODE) – p.49/89
k1 = hf (t0 , x0 ) = f (1, 1) = 2,
                  h        k1
                              !
k2 = hf t0 + , x0 +             = f (1.5, 2) = 2.333333,
                  2        2
                  h        k2
                              !
k3 = hf t0 + , x0 +             = 2.444444,
                  2        2
k4 = hf (t0 + h, x0 + k3 ) = 2.722222.
                                        Ordinary Differential Equations (ODE) – p.50/89
We find
                      1
          y1   = 1 + (2 + 2 ∗ 2.333333
                      6
               + 2 ∗ 2.444444 + 2.722222)
               = 3.379630.
Similarly, we calculate y2 .
                                     Ordinary Differential Equations (ODE) – p.51/89
      System of First Order
      ODE’s
We consider the n system of first order equations
    dy1
          = f1 (x, y1 , y2 , · · · , yn ), y1 (x0 ) = y10 ,
    dx
    dy2
          = f2 (x, y1 , y2 , · · · , yn ), y2 (x0 ) = y20 ,
    dx
          ···
    dyn
          = fn (x, y1 , y2 , · · · , yn ), yn (x0 ) = yn0 .
    dx
With the help of single step methods, we find the
approximate solution for the system of n
equations.                                    Ordinary Differential Equations (ODE) – p.52/89
We now consider the two first order equations of
the form
        dy1
            = f1 (x, y1 , y2 ), y1 (x0 ) = y10 ,
        dx
        dy2
            = f2 (x, y1 , y2 ), y2 (x0 ) = y20 .
        dx
We use RK second order and fourth order
method to solve the system of equations.
                                          Ordinary Differential Equations (ODE) – p.53/89
     2nd Order RK Method
The formula for second order RK method with
step size h is
                             1
         y1,n+1   = = y1,n + (s1 + k1 ),
                             2
                           1
         y2,n+1   = y2,n + (s2 + k2 ),
                           2
where
            k1 = hf1 (xn , y1n , y2n ),
            k2 = hf2 (xn , y1n , y2n ),
                                          Ordinary Differential Equations (ODE) – p.54/89
      s1 = hf1 (xn + h, y1n + k1 , y2n + k2 ),
      s2 = hf2 (xn + h, y1n + k1 , y2n + k2 ).
Similarly, the formula for fourth order RK-method
is
                      1
     y1,n+1   = y1,n + (k1 + 2s1 + 2l1 + p1 ),
                      6
                      1
     y2,n+1   = y2,n + (k2 + 2s2 + 2l2 + p2 ),
                      6
                                      Ordinary Differential Equations (ODE) – p.55/89
where
    k1 = hf1 (xn , y1n , y2n ),
    k2 = hf2 (xn , y1n , y2n ),
                     h            k1               k2
    s1 = hf1 (xn + , y1n +           , y2n +          ),
                     2            2                2
                     h            k1               k2
    s2 = hf2 (xn + , y1n +           , y2n +          )
                     2            2                2
                                        Ordinary Differential Equations (ODE) – p.56/89
                 h         s1          s2
l1 =   hf1 (xn + , y1n + , y2n + ),
                 2         2            2
                 h         s1          s2
l2 =   hf2 (xn + , y1n + , y2n + ),
                 2         2            2
p1 =   hf1 (xn + h, y1n + l1 , y2n + l2 ),
p2 =   hf2 (xn + h, y1n + l1 , y2n + l2 ).
                                  Ordinary Differential Equations (ODE) – p.57/89
      Example 2
Use RK-method 2nd order and 4th order to find
the approximate solution of y(0.1) and z(0.1) as a
solution of pair of equations
                   dy
                      = x + z,
                   dx
                   dz
                      = y−x
                   dx
with the initial conditions
               y(0) = 1, z(0) = −1.
Take step size h = 0.1.               Ordinary Differential Equations (ODE) – p.58/89
      Multistep Methods
The general form of a linear m-step multistep
method is
    yn+1 − a1 yn − a2 yn−1 − · · · − am yn+1−m
                          hi
            = b0 f (xn+1 , yn+1 ) + b1 f (xn , yn )
               + · · · + bm f (xn+1−m , yn+1−m ).
When b0 = 0, the method is called explicit,
otherwise, it is said to be implicit.
In multistep method, we require multiple starting
values.                                    Ordinary Differential Equations (ODE) – p.64/89
      Adams-Bashforth
      Methods
We assume a uniform discretization in the
x-domain, i.e., we define
                      xi = a + ih,
where h =    N ,
            b−a
                   for some positive integer N .
Let the given differential equation is of the form
                    y 0 (x) = f (x, y).
We now integrate the given differential equation
from x = xi to x = xi+1 .
                                          Ordinary Differential Equations (ODE) – p.65/89
This yields the equation
                             Z x
                                 i+1
       y(xi+1 ) − y(xi ) =             f (x, y(x)) dx.
                              xi
Next, we write
        f (x, y(x)) = Pm−1 (x) + Rm−1 (x),
                                              Ordinary Differential Equations (ODE) – p.66/89
where
                m
                X
   Pm−1 (x) =         Lm−1,j (x)f (xi+1−j , y(xi+1−j )),
                j=1
is the Lagrange form of the polynomial of degree
at most m − 1 that interpolates f at the m points
xi , xi−1 , xi−2 , · · · , xi+1−m .
                                            Ordinary Differential Equations (ODE) – p.67/89
And
                 f (m) (ξ, y(ξ)) m
      Rm−1 (x) =                Πj=1 (x − xi+1−j )
                        m!
is the corresponding remainder term.
                                        Ordinary Differential Equations (ODE) – p.68/89
      Two-Step Adams
      Bashforth Method
Since m = 2, we write
                 x − xi−1
   f (x, y(x)) =              f (xi , yi )
                 xi − xi−1
                   x − xi
               +              f (xi−1 , yi−1 )
                 xi−1 − xi
                 f 00 (ξ, y(ξ))
               +                (x − xi )(x − xi−1 ).
                        2
Integrating the Lagrange polynomials yields
                                         Ordinary Differential Equations (ODE) – p.69/89
       Z x
           i+1   x − xi−1       3h
b1 =                       dx = ,
        xi       xi − xi−1       2
       Z x
           i+1    x − xi           h
b2 =                       dx = − .
        xi       xi−1 − xi         2
                                Ordinary Differential Equations (ODE) – p.70/89
Therefore, the two-step Adams-Bashforth
method is
                 h
    yn+1   = yn + [3f (xn , yn ) − f (xn−1 , yn−1 )] .
                 2
Proceeding in a similar manner, the three step
Adams-bashforth method is
                 h
  yn+1   = yn + [23f (xn , yn ) − 16f (xn−1 , yn−1 )
                12
         + 5f (xn−2 , yn−2 )].
                                           Ordinary Differential Equations (ODE) – p.71/89
The four-step Adams-Bashforth method is
                h
 yn+1   = yn + [55f (xn , yn ) − 59f (xn−1 , yn−1 )
               24
        + 37f (xn−2 , yn−2 ) − 9f (xn−3 , yn−3 ].
                                      Ordinary Differential Equations (ODE) – p.72/89
      Example 5
Use two-step Adams-Bashforth method to find
the approximate solution of
                  dx       x
                      = 1+ ,
                   dt      t
                 x(1) = 1,
near x(1.5). Take step size h = 0.5.
                                       Ordinary Differential Equations (ODE) – p.73/89
      Solution
The two-step Adams-Bashforth formula is
                 h
    xn+1   = xn + [3f (tn , xn ) − f (tn−1 , xn−1 )] .
                 2
We note that for finding x2 , we require x1 and x0 .
We calculate x1 with the help of second order
Taylor’s method
                       x1 = 2.125.
                                           Ordinary Differential Equations (ODE) – p.74/89
Now,
                   h
       x2   = x1 + [3f (t1 , x1 ) − f (t0 , x0 )] ,
                   2
            = 3.4375.
                                           Ordinary Differential Equations (ODE) – p.75/89
       Adams-Moulton
       Methods
The derivation of Adams-Moulton methods
follows exactly the same procedure as the
derivation of the Adams-Bashforth method with
one exception.
In addition to interpolating f at
xi , xi−1 , xi−2 , · · · , xi+1−m , we also interpolate at
xi+1 .
                                             Ordinary Differential Equations (ODE) – p.76/89
Hence, we write
            f (x, y(x)) = Pm (x) + Rm (x),
where
                 m
                 X
      Pm (x) =         Lm,j (x)f (xi+1−j , y(xi+1−j )),
                 j=0
and
               f (m+1) (ξ, y(ξ)) m
      Rm (x) =                  Πj=0 (x − xi+1−j ).
                   (m + 1)!
                                             Ordinary Differential Equations (ODE) – p.77/89
Since Pm (x) contains a term involving
f (xi+1 , y(xi+1 )), the resulting method will be
implicit.
Furthermore, by using an additional point in the
interpolating polynomial the degree of the
remainder term is increased by one over the
Adams-Bashforth case.
                                        Ordinary Differential Equations (ODE) – p.78/89
       2-Step Adams-Moulton Method
Since m = 2, we write
                     (x − xi )(x − xi−1 )
f (x, y(x)) =                               f (xi+1 , yi+1 )
                 (xi+1 − xi )(xi+1 − xi−1 )
                          (x − xi+1 )(x − xi−1 )
                       +                          f (xi , yi )
                         (xi − xi+1 )(xi − xi−1 )
                     (x − xi+1 )(x − xi )
             +                              f (xi−1 , yi−1 )
                 (xi−1 − xi+1 )(xi−1 − xi )
          f 000 (ξ, y(ξ))
        +                 (x − xi+1 )(x − xi )(x − xi−1 ).
                  6
                                               Ordinary Differential Equations (ODE) – p.79/89
Integrating the Lagrange polynomials yields
         Z x
             i+1      (x − xi )(x − xi−1 )          5h
  b0 =                                        dt = ,
          xi       (xi+1 − xi )(xi+1 − xi−1 )       12
         Z x
             i+1    (x − xi+1 )(x − xi−1 )       2h
  b1 =                                      dt = ,
          xi       (xi − xi+1 )(xi − xi−1 )       3
         Z x
             i+1      (x − xi+1 )(x − xi )            h
  b2 =                                        dt = − .
          xi       (xi−1 − xi+1 )(xi−1 − xi )         12
                                           Ordinary Differential Equations (ODE) – p.80/89
Therefore, the two-step Adams-Moulton method
is
          yi+1 − yi       5
                       = f (xi+1 , yi+1 )
              h          12
         2              1
        + f (xi , yi ) − f (xi−1 , yi−1 ).
         3              12
To find the approximate solution, we required y0
and y1 .
The initial condition give y0 and y1 can be
obtained using any third order one-step method.
                                        Ordinary Differential Equations (ODE) – p.81/89
Similarly, we derive the three-step
Adams-Moulton method is given by
                        h
         yi+1 = yi + [9f (xi+1 , yi+1 )
                        24
         +19f (xi , yi ) − 5f (xi−1 , yi−1 )
                         +f (xi−2 , yi−2 )].
The required starting values for the three step
method should be obtained using a fourth-order
one-step method.
                                           Ordinary Differential Equations (ODE) – p.82/89
      Predictor-Corrector
      Method
The most popular of the predictor-corrector
scheme is the Adams fourth-order
predictor-corrector method.
This uses the four-step, fourth-order
Adams-Bashforth method
   (0)           h
  yn+1   = yn + [55f (xn , yn ) − 59f (xn−1 , yn−1 )
                24
         + 37f (xn−2 , yn−2 ) − 9f (xn−3 , yn−3 )],
as a predictor
                                        Ordinary Differential Equations (ODE) – p.83/89
followed by the three-step, fourth-order
Adams-Moulton method
   (1)           h               (0)
  yn+1   = yn + [9f (xn+1 , yn+1 ) + 19f (xn , yn )
                24
         − 5f (xn−1 , yn−1 ) + f (xn−2 , yn−2 )],
as a corrector.
                                       Ordinary Differential Equations (ODE) – p.84/89
Note that the computation of y4 , we require the
                                        (0)
values (x0 , y0 ), (x1 , y1 ), (x2 , y2 ), (x3 , y3 ).
These values should be given with the given
equation or should be computed using single
step methods like, Euler’s method, Taylor’s
method or Runge-Kutta methods.
To compute the value         y4 ,   we require the values
                              (1)
       (x1 , y1 ), (x2 , y2 ), (x3 , y3 ) and
                                                       (0)
                                                (x4 , y4 ).
                                                  Ordinary Differential Equations (ODE) – p.85/89
      Modifier
Let y(xn+1 ) denotes the true solution of y at xn+1 .
Then
            (0)   251 5 (iv)
y(xn+1 ) = yn+1 +     h f (ξ1 ), xn−3 < ξ1 < xn+1 ,
                  720
            (1)    19 5 (iv)
y(xn+1 ) = yn+1 −     h f (ξ2 ), xn−2 < ξ2 < xn+1 .
                  720
On subtracting, we get
               (0)        (1)     270 5 (iv)
         0=   yn+1   −   yn+1   +     h f (ξ).
                                  720
                                          Ordinary Differential Equations (ODE) – p.86/89
This implies that
            (1)        (0)     270 5 (iv)
           yn+1   −   yn+1   =     h f (ξ).
                               720
We rewrite as
          h5 (iv)     1 (1)       (0)
             f (ξ) =     (yn+1 − yn+1 ).
         720         270
                                         Ordinary Differential Equations (ODE) – p.87/89
Finally, we find the modifier as
                (1)       19 (1)      (0)
  y(xn+1 ) −   yn+1   =−     (yn+1 − yn+1 ) = Dn+1 .
                         270
Here, Dn+1 is called as modifier.
                                         Ordinary Differential Equations (ODE) – p.88/89
      Example
Find y(1.4) by Adams Moulton 4th order
predictor-corrector pair with modifier as a
solution of
                   dy
                      = x3 + xy,
                   dx
y(1) = 2, y(1.1) = 1.6, y(1.2) = 0.34 and
y(1.3) = 0.594 with spacing h = 0.1.
                                     Ordinary Differential Equations (ODE) – p.89/89