0% found this document useful (0 votes)
65 views24 pages

Unit Singlestep Methods Solving Initial Value Problems: Structure No

1) The document discusses singlestep numerical methods for solving initial value problems (IVPs) of first and higher order ordinary differential equations. 2) It introduces the Taylor series and Runge-Kutta methods for approximating solutions to IVPs. These methods are presented for both single equations and systems of equations. 3) The accuracy and stability of singlestep methods are analyzed, with the order of a method relating to the size of its truncation error term. Higher order methods have smaller errors.

Uploaded by

JAGANNATH PRASAD
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views24 pages

Unit Singlestep Methods Solving Initial Value Problems: Structure No

1) The document discusses singlestep numerical methods for solving initial value problems (IVPs) of first and higher order ordinary differential equations. 2) It introduces the Taylor series and Runge-Kutta methods for approximating solutions to IVPs. These methods are presented for both single equations and systems of equations. 3) The accuracy and stability of singlestep methods are analyzed, with the order of a method relating to the size of its truncation error term. Higher order methods have smaller errors.

Uploaded by

JAGANNATH PRASAD
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

UNIT 8 SINGLESTEP METHODS FOR

SOLVING INITIAL VALUE


PROBLEMS
Structure Page No.
8.1 Introduction 5
Objectives
8.2 Preliminaries 5
8.3 Taylor Series Methods 6
8.4 Runge-Kutta Methods 12
8.5 Stability of Singlestep 'Methods 19
8.6 Summary 24
8.7 Solutions/Answers 25
Practical Assignments 28
8.1 INTRODUCTION
Many physical problems in science and engineering are modelled in the form of
ordinary differential equations. The solution of the differential equation is the
function that satisfies the differential equation and the given initial or boundary
condit~ons. Such a solution is called the exact or the analytical solution. The methods
for finding the exact solution are limited to certain special form of equations, mostly
linear, homogeneous equations with constant coefficients or, to certain non-
homogeneous equations with non-homogeneous terms restricted to some standard
functions. However, numerical methods do not have any such limitations.
In this unit we shall discuss singlestep numerical methods for solring the initial value
problems of first and higher orders. We shall start the unit with some preliminaries in
Sec.8.2, which are required for further discussion in this unit. In Sec.8.3, we shall
discuss Taylor series methods of first and higher order for solving single or system of
initial value problems. Runge-Kutta methods of first and higher order will be
discussed in Sec.8.4 both for single as well as system of equations. Finally, we shall
discuss the stability of these singlestep methods in Sec.8.5.
Objectives
After studying this unit you should be able to
r explain singlestep and multistep methods for solving initial value problems;
use Taylor series and Runge-Kutta methods for solving initial value problems;
r obtain the interval of absolute stability for a given singlestep method.
tb

8.2 PRELIMINARIES
c We start with giving some of the basic definitions in thls section.
Consider the nth-order initial value problem (IVP)
y(I1'(x)= f(x, y, y',...,y("-")
y(xo) = yo,yl(xo) = y;,..., y(I1-I'(xo)= yr-"
where xo is the initial point.
The nth order IVP (1) is equivalent to the following system of n first order initial value
problems. We write y = yl and

YL= YI, Y n-1 (xO ) = Y;-"


Y: =f(x,y1,y2,...,yn) 9Y~(XO)=Y~-"
In vector notation, this system can be written as
Numerical Solutions yf(x)=f(x,y), ~ ( x , )= a
of ODES
where

Hence, it is sufficient to study numerical methods for solving the single first order IVP
yl(x)=f(x,y>, y(xo)= Yo (4)
and then extend these methods for solving the system of first order WP's (3) or, the
nth order IVP(1).
We assume that the solution of the IVP(4) exists and is unique and also f(x, y) has
continuous partial derivatives with respect to x and y of as high order as required for
all x in the interval [x, ,b], in which the solution of the IVP(4) is to be obtained.
We divide the interval [x,, b] into N subintervals by the points
X o <XI < X 2 . . . < X N= b

The points x, , x , , . .., x, are called the nodal point, grid points or the mesh-
points. We assume that the nodal points are equispaced with the spacing or the step
length
h = X N - X o , where x, = b (5)
N
We obtain
x i = x , + i h , i=1,2,...,N
In numerical methods, we determine y, which is an approximate value of the exact
solution y(x) at the nodal point x, , that is
Yl xi) (6)
The numerical methods for solving the initial value problems can be broadly classified
into two categories
(i) singlestep methods, (ii) multistep methods.
In singlestep methods, the solution value yi+,at the nodal point xi+,, is obtained by
using the solution value y; at only the previous point xi. Such a method is called an
explicit singlestep method and is written as
Y,+, = y I + h $ ( x i , y i , h ) , i=0,1,... (7)
where h is the step size and 4 is called the increment function. If the method also
uses the solution value yi+,,then the method is called an implicit singlestep method.
In multistep methods, the solution value yi+,at the nodal point xi+, is obtained by
using the previously calculated k-values yi-, at the previous k nodal points
xi-,, m=O,l,,.., (k-1).
If the error in the numerical method (truncation error)
TE = xi+^ 1- YI+I
\
can be written as
TE = c hP+lY ( ~ + ' )(c), xi-, < 5 < x,+, (8)
where C is a constant independent ofh, then the method is said to be of order p.
With this background we shall now discuss singlestep methods of various orders. In
this unit we shall confine our discussion only to explicit singlestep methods.

8.3 TAYLOR SERIES METHODS


Consider the TVP
yt=f(x,y), y(x,)= Yo. (9)
We assume that y(x) can be expanded in Taylor series about any point xi, that is,
Singlestep Methods
for Solving lVPs

Substituting x = and x i+l - x i = h ,we get

which is an infinite series. If we retain terms upto pth powers of h, we obtain

where yi is an approximation to y(xi).


The error term is given by
error = Y(~i+l) - Y i+l

which is also an infinite series.


The principal error term, called the truncation error (TE) is obtained as
TE - y(~+')
(5) X i < 5 < Xi+,
(P + 1)
Therefore, the method (12) is of order p.

The method (1 1) is called the Taylor's series method of order p. For different \
of D. we obtain different order methods.
p = 1: first order Taylor series method
Yi+l = Y i +hYf

Or, yi+,= y i + h f ( x i , y i ), i=0,1,-..

This method is also called the Euler method.


p = 2: second order Taylor series method

C : and so on.
The higher order derivatives ylm),m = 1,2,. .. in Eqn.(l2) can be obtained by
differentiating the given differential equation repeatedly and evaluating them at the
nodal point xi.
System of first order IVP's
For the system of first order IVP's (3)
yl(x)=f(x,y), Y(x,,)=~
we write the method (12) as'
uA
Note that each term in Eqn.(l5) is a column vector having the same number of
elements as the number of first order differential equations.

The truncation error associated with the method (15) is niven bv

and hence the method (15) is of order p

Example I: Obtain the approximate value of y(1.4) for the initial value problem
yl=-2xy2, y(l)=l
using .
(a) Taylor series method of first order (Euler method)
(b) Taylor series method of second order with (i) h = 0.1, (il) h = 0.2. Compare the
1
results with the exact solution y(x) = -
x2'
Solution:
(a) Taylor series method of first order is given by

(i) For h = 0.1, we obtain for


i=0: x, =l,yo =1,y; =-2xoyo2 =-2
y, my(l.l)=yo +hyb =l+0.1(-2)=0.8
i=l : x, =l.l,yl =0.8,y; =-2x, y: =-1.408
y2 2: y(1.2) = y l + h y; =0.8+ (0.1)(-1.408) =0.6592
i=2: x,=1.2,y2=0.6592,y',=-2~2yf=-1.042907
y, E* y (1.3) = y1 + h yk = 0.544909
1= 3 : x, = 1 . 3 , =0.544909,y',
~~ =-2x, Y: =-0.772007
y4 2. y(1.4)=y3 + hy; =0.467708
We also have from the exact solution
y(1.4) = lJ(1.4)~= 0.510204
Actual error at x = 1.4 = y(1.4) - y, = 0.0425 .
(ii) For h = 0.2, we obtain .
1=0: x, =l,yo =1,y; =-2xo yo1 =-2
y, =y(1.2)=yo +hy; =l+0.2(-2)=0.6
i=1: x, ~ 1 . 2=0.6,yi
, ~ ~ =-2x, y:=-0.864
y, ay(1.4)=y1 + h y ; =0.4272
Actual error at x = 1.4 = y(1.4) - y, = 0.0830.
(b) Taylor series method of second order is given by

We have ,
y'=-2xy2, y; = -2 xi y;
2
y"=-2y2 - 4 x y y f , y;=-2yi - 4 x i y i y ;
(i) or h = 011, we obtain Siagbtep Methods
i=O : X, = l , y o = I , yb = - 2 , ~ ; = 6 for Solving IVPs

h2
y4 zy(1.4)=y3 + h y ; +-y; =0.514920
2
Actual error at x = 1.4 = y(1.4) - y 4 = -0.0047.

(11) For h = 0.2, we obtain


i=0: x, = l , y o =I,yb =-2,y; = 6

Actual error at x = 1.4 = y(1.4) - y, = -0.0262

Remark: You may notice that the actual emor in\magnitude decreases when (i) h is
reduced or (ii) higher order method is used.
~ x a & l e 2: Solve the initial value problem yr = x 2 + y2, y(0) = 1 upto x = 0.4
using fourth order Taylor series method with h = 0.2.
Solution: The fourth order Taylor series method is given by

We have,
y ' = ~ 2+
y2 , y!I = x 2l + yzl
y"=2x+2yy1 3 y; = 2xi + 2yi y;
y" = 2 + 2(Y1)*+ 2y y" , y;= 2 + 2(y;)2 + 2yi y"
yiV= 6yry" + 2y y" , Yr 6yi yf + 2yi y:
=
For h = 0.2, we obtain
Numerical Solutions
of ODES
Example 4: Reduce the second order initial value problem Singlestep Methods
y"=yl+l for Solving IVPs

y(0) = 1, y1(0) = 1
to a system of first order initial value problems. Hence, find an approximate value of
y(0.4) and yr(0.4) using Taylor series second order method with h = 0.2.
Solution: Set y = yl, we get
YI = Y 2 y,(O)=l
9

Y; = l + y , y2(0)=1
9

we have

The second order Taylor series method is given by


h
( Y ) . ~ + , = ( Y ) ~ ~ + ~ ( Y ) , ~ + ~ ( i=O,l,...
Y').,'
For h = 0.2, we get
i =o: =[ i: 1,.
x,, = o . ( ~ ) ~ ~ =[:]~(yf)xo
:;,1, = [:I

Hence, y(0.4) = 1.5768 and y'(0.4) = 1.9768.


***
You may now try the following exercises.

El) Obtain the approximate value y(1.2) for the initial value problem
y l = - y 2 , y(l)=l
using Euler method with h = 0.1 .
E2) Solve the initial value problem
yf = 2x + 3y, y(0) = 1
Numerical Solutions in the interval [O, 0.41 using (a) Taylor series second order method, (b) Taylor
of ODES series fourth order method. Take h = 0.2 in each case.
E3) Solve the initial value problem
y1= x + sin y, y(1) = 1
in the interval [I, 1.21 using (a) Taylor series second order method, (b) Taylor
series fourth order method. Take h = 0.1 in each case.
E4) Find the approximate value of y (0.4) and u (0.4) for the system of
equations
y 1 = 2 y + u , y(O)=l
u 1 = 3 y + 4 u , u(O)=l
using Taylor series second order method with h = 0.2
E5) Write the second order initial value problem
y" = -2y y', y(0) = 1, yl(l) = 1
as a system of two first order initial value problems. Hence, obtain approximate
value of y(1.4) and y'(1.4) using second order Taylor series method with
h =0.2.

Taylor series method of any arbitrary order for solving the initial value problem (4)
can be easily obtained. However, from application point of view, Taylor series
method has a serious disadvantage. The method requires evaluation of derivatives of
higher order for the function f(x, y) of two variables x and y. These higher order
derivatives have to be obtained manually for each problem. Therefore, we need to
develop methods, which do not require the evaluation of higher order derivatives and
still compare with the Taylor series methods. One such class of methods is the Runge-
Kutta methods which we shall discuss in the next section.

8.4 RUNGE-KUTTA METHODS


To illustrate the idea behind Runge-Kutta methods, we integrate y' = f(x, y) in the
interval [xi ,x i+, ] and obtain

Xltl

or, y(xi+,)= y(x,) + If(X,Y)dX (16)


XI

We note that f (x, y) is the slope of the solution curve and it changes continuously in
[xi ,x ,+,1.
Let the continuously varying slope f(x, y) in this interval be
approximated by the fixed slope at x = x i , that is, f(x,y) r; f ( x i , y i ) in [xi ,x,+,]
Then from Eqn.(l6), we obtain

Xi

Or, Yi+j = Y i + h f ( x , , ~ i )

which is the Euler method (13).


Now, approximate f(x, y) in [xi,x,+,]bythe slope at the point x = that is,
f (x, Y) f(xi+l,Y , + I ) .

Then, we obtain from Eqn.(l6)


Xitl

Y , + I = Yi + f(xi+l,Y i+l) Jdx


which is the backward Euler method. This method is an implicit method. The non- Singlestep Methods
linear equation in yi+, for non-linear problems can be solved using the Newton- for Solving IVPs
Raphson method.
Now, approximate f(x, y) in [xi,x,+,]bythe mean of the slopes at x = xi and
1
, is, f(x, y) = -[f(x, ,y, ) + f(x,+,,yi+,)]. Then we obtain the implicit
x = x i + l that
2
method.
h
Yi+l = Yi +-[f(~i,Yi)+ f(xi+l,Yi+~)I
2
which is called the trapezoidal method.
If we approximate yi+, in the right side of Eqn.(l9) by the Euler method (17), then we
obtain the explicit method
h
Yi+l=Yi+-[f(xi,yi)+f(xi+h,yi+hfi)]
2
where fi = f(x, ,y, ) . This method is called the Heun's method or Euler Cauchy
method. We can re-write this method in the form

where, K , = h f ( x i , y , )
(20)
K 2 = h f ( x i + h,yi + K , )
The philosophy behind the Runge-Kutta methods is to consider a weighted average of
slopes or approximate slopes at a number of points in [xi ,xi+,]. If we use v slopes,
then the method is written as
yi+,= y i + w , K I + w 2 K 2 wvKv,
+ . a * + (21)
where,
K, =hf(xi,yi)
K 2 = h f ( x i + a 2 h , y i+ P,, K , )

v-l
xi + a , h , y , + Z P , ~ ~
j=l I
w ' S,a i'S and Pi 's are parameters to be determined such that the method (21) agrees
with the Taylor series method of certain order.
\
We shall only discuss the cases v\= 2 and v = 4 which provide the methods of orders 2
and 4 respectively.
Second order Runge-Kutta method (two stage method)
Consider the following two-stage method
Yi+l = Y i + W I K I +w2 K2
where
K , - =h f ( x i , y i )
K 2 = h f ( x i + a 2 h , y i+ P 2 , K l )
Expanding KI and K2 in Taylor series about the point xi, we get
K, = h f ( x i , y i ) = h f i
:.K2= h f ( x i + a 2 h , y i + p , , h f i )
Numerical Solutions
of ODES

where the partial derivatives are evaluated at the point (xi , y i ) . Substituting the
expressions for KI and K2 in Eqn.(20), we get

From the given differential equation, we get


y1= f (x, Y)
af a dy af af
yR=-+--=- +f -
dxaydxdx t?y

Now, Taylor series method for solving the given differential equation is given by
h2 h3
Y ( x ~ + ~ ) = Y ( hyl(xi)+-yW(xi)+-ym(xi)+-..
x~)+
2! 3!

where partial derivatives are evaluated at the point (xi, yi).


Comparirrg the coefficients of h and h2 in Eqns.(23) and (24) we obtain
w, + w, = 1

1
w2 P2l =- (25)
2
It is not possible to compare the coefficient of h3, as there are three terms in Eqn.(23)
and five terms in Eqn.(24).
The solution of the system of Eqn.(25) is obtained as
and a, # 0 is arbitrary. The method (22) becomes Singlestep Methods
for Solving lVPs
(26)

where
K, = h f ( x i , y i )
: K, = hF(xi + a 2 h , y i+ a , K , )
The truncation error associated with the method is given by
TE = ~ ( x i + - l )Y i + l

--(- ax + g]]+
+ laf
6 a ~
af
fi 0(h4)

Therefore, the two stage Runge-Kutta method (26) is a second order method for all
values of a,. For different values of a, we obtain different second order methods.
1
For a, = 1, we get, P,, = l,w, = w --and the method is
,-2
1
Yi+l = Y i +-('I
2
+',I
K, = h f ( x , , y , )
K, = h f ( x i + h , y i + K , )
which is the Euler-Cauchy method or the Heun method (18)
1 1
,
For a - -, we get p,, = -, w, = 0,w = 1 and the method is
2-2 2
Y i + l = Y i +K2

K, =hf(x,,y,)

which is also called the modified Euler-Cauchy method.


Fourth order Runge-Kutta method (Four-stage method)
Without derivation, we list one of the four stage Runge-Kutta methods
1
yi+,= yi + -(K, + 2K2 + 2K, + K,)
6

K, = h f ( x i + h , y i + K , )
which is called the classical Runge-Kutta method and is of fourth order.
Remarks
1. Both Taylor series method and Runge-Kutta methods are singlestep methods.
2. We require two function evaluations per step for a second order Runge-Kutta
method and four function evaluations per step for a fourth order Runge-Kutta
method.
System of first order IVP's
For the system of n first order IVP's (3)
yl=f(x,y),y(x,)=a
we write the Runge-Kutta methods as follows:
Numerical Solutions Second order method (27)
of ODES

where

and
KJI =hfj(xi,Y1i,Y2i,'.',Yni) *
Kj2 = h f j ( x i + h , y l i + K I I , ~ +K2I,"',Yni
2i +Knl)
j = 1,2, ...,n.
Fourth order method (29)

Kll rK12 Kt, K14

where, K , = I K ; , K 2 = ~ K ; ; ] , K 3 = I K y ] 9 K 4 = I K 7 ]

K1l~ - 'n2 'n3 'n4

and
Kjl =hfj(~~,~li~Y2i,...,Yni)

1 1
+-K12,y2i +- K22,...,yni
2 2
Kj4 = hf,(xi + h,yli + Ku9y2i+'K23,..-,yni + ~ n 3 )

j=1,2 ,...,n.
We shall now illustrate the methods discussed above through examples.
Example 5: Solve the initial value problem
Y'=x'+y2,y(l)=2
on the interval [1, 1.41 using the second order Runge-Kutta method (27) with h = 0.2.
Solution: We are given that f(x, y) = x 2 + y 2 and h = 0.2.
- We obtain from Eqn.(27) for
i=O: xo =l,yo = 2
K , = h f ( x 0 , y , ) = hf(l,2)=0.2[(1)~+ (2)']=1
K 2 = h f ( x o + h,yo + ~ , ) = h f ( 1 . 2 , 3 ) = 0 . 2 [ ( 1 . 2 )+3']=2.088
'
Example 6: Find an approximate value of y(0.8) for the initial value problem. Singlestep Methods
y1= fi, y(0.4) = 0.41
for Solving lVPs

using the second order Runge-Kutta method (26) with h = 0.2.


Solution: We are given that f(x, y) = f i and h = 0.2.
We obtain from Eqn.(26), for

Example 7: Find an approximate value of y(0.2) for the inltlal value problem
~ ' = l + y(O)=l
~ ~ ,
using the classical Runge-Kutta fourth order method (29) with h = 0.1.
Solution: We are given that f (x, y) = 1+ y2 and h = 0.1.
We obtain fiom Eqn.(29) for
Numerical Solutions
of ODES

Example 8: Solve the system of lVP's


y r = 2 y + z , y(0) = 1
z' = 3y + 42, z(0) = 1
on the interval [O, 0.41 using second order Runge-Kutta method (30) with
h = 0.2.
Solution: We are given that f , (x, y, z) = 2y + z, f, (x, y, z) = 3y + 4z
and h = 0.2. We obtain from Eqn.(30), for
i=O: x, =O,y, = l , z o = I
K l l = h f l ( ~ o , ~ o , ~ o ) = h f1,l (l)=0.6
O,
K2, = h f 2 (x,,y,,z,)=hf, (O,l, 1)=1.4
K1, = h f , ( x o + h , y , + K , , , z o +K2,)=hf,(0.2, 1.6, 2.4)=1.12
K2, = h f 2 ( x 0+ h , y o + K l l , z 0+ K 2 , ) = h f 2 ( 0 . 2 ,1.6, 2.4)=2.88

z, = 40.2) = z , +-1 [K,, + K,,]= 1


1+-[1.4 + 2.88]=3.14
2 2
i=l: x, =O.2,yl =1.86,z, =3.14
K,, = h f , ( ~ , , y , , z , ) = h f , ( 0 . 2 1.86,
, 3.14)=1.372
K,, = h f , ( x , , y , , z , ) = h f , (0.2, 1.86, 3.14)=3.628
K,, = h f l (x, + h,yl + K l l , z , + K 2 , ) = h f I ( 0 . 4 , 3.232, 6.768)=2.6464
K2, = h f2(x, + hl yl + K l l, z I + K 2 , )= h f (0.4, 3.232, 6.768) = 7.3536

And now some exercises for you.


E6) Solve the IVP
y ' = x + y Z , y(O)=l
on the interval [O,0.4] using Runge-Kutta second order method (27) with
h =0.2.

E7) Find an approximate value of y(1.2) for the initial value problem

using Runge-Kutta second order method (28) with h = 0.1.

E8) Find an approximate value of y(2.4) for the initial value problem
y1= x(y - x), y(2) = 3
using classical fourth order Runge-Kutta method with h = 0.2.

E9) Solve the initial value problem


y' = x + cos y, y(1) = 1
in the interval [I, 1.21 using classical fourth order Runge-Kutta method with Singlestep Methods
h=0.1. for Solving lVPs

E10) Solve the system of IVP's


y' = xz + 1, y(0) = 0
z1= xy , z(0) = 1
on the interval [O, 0.41 using second order Runge-Kutta method (30) with
h = 0.2.
3
El 1) Write the second order IVP y" = - y 2 ,y(0) = 1, yl(0) = 1, as a system of two
2
first order IVP's . Obtain approximate value of y(0.4) and y'(0.4) by solving
this system using Rung-Kutta fourth order method (3 1) with h = 0.2.

We shall now find the interval of stability for various methods discussed above.

8.5 STATBILITY OF SINGLE STEP METHODS


The numerical solution y is an approximation of y(xi ) and contains errors (both
truncation error and round off error). The en-or
Ei= ~ ( x i ) - ~ i
is called the numerical error at the nodal point xi . If the error remains bounded as
i -+ a3 (or h + 0), then the numerical method is said to be stable.

We discuss the stablllty of the single step methods by applying the method to the test
equation.
yl=Ay, y(x,) = Yo (32)
where A is a positlve or a negative constant. The exact solutlon of Eqn.(30) IS
obtained as
j.(\-x,,)
Y(X)= y(x,)e
Substltutlng x = x, and x = x,+,, we get
y(x,) = Y(Xo)e'.('l-\~' = Y(xo)e"'"

y(x,+,) = Y ( X u ) e'('~-l-\~'= y(x,)e"'"''"


Divldlng the above two equations, we get

Hence, we obtain
y(x,+, = eA"y(x, (33)
and h is the step sue.
The exact solution of Eqn.(32) grows (when A > 0 ) or decays (when A < 0 ) by the
'growth-factor e'." .
When we apply a numerical method to solve Eqn.(32), we obtaln a relation of the form
Y,+l = E(Ah)y, (34)
where E(Ah) is some approximation to e"" . The numerical solution grows or decays
by the growth factor E(Ah) . The growth factor E(Ah).should behave similar to
e"" for meaningful results.
Substltutlng y, = y(x, )+ E , and y ,+, = y(x,+,)+ E,,, , we get
y(x,+,)+ € , + I = E ( ~ [ (x,
Y )+ E,]
Slnce y(x,+,) = y(x, ) e'" , we get
y(x,) e'.ll+ EITl = E(1l-l) [Y(x,) + E , ]
Numerical Solutions
of ODES

Thus the error Ei+r at the nodal point xi+, consists of two parts.
The first part E(hh) - eAhis the local truncation error and can be made as small as
we l ~ k eby increas~ngthe order of the numerical method or by reduc~ngthe step size h.
We find that this error -+ 0 as h -+ 0 .
, called the propagation error. We consider the following
The second part E ( h h ) ~ is
two cases
Case 1: h < 0
In this case the exact solution decreases. For meaningful numerical results, the growth
fictor E(hh) of the numerical solution should decay at least as fast as eAh, the growth
factor of the exact solution. sinceeLh< 1 for A < 0 , we obtain the condition

and the method in this case is called absolutely stable. In this case y i -+ 0 as i -+ a,.
The set of values of hh which satisfy Eqn.(36) give the interval of absolute stability
(hh, 0) for the given method. If the interval of absolute stability is ] - cn, 01, then the
method is called A-stable.
Case 2: h > 0
In this case the exact solution increases. For meaningful numerical results, the growth
factor E(hh) of the numerical solution should not increase faster than the growth
factor e" of the exact solution. Therefore, we obtain the condition

and the method is called relatively stable.


The set of the values of hh which satisfy Eqn.(37) give the interval of relative
stability (0, Ah).
Remarks
1) If h<O , we consider absolute stability and if h > 0,we consider relative stability
2) The test Eqn.(32) is the linearised form of y' = f (x, y).
3) For the general initial value problem y' = f(x, y), y(x,) = y, we generally take
= (af *Lo.
Now, we obtain the intervals of absolute stability for the Taylor series and Runge-
Kutta methods discussed earlier.
Taylor series method
For the N P
Y' = hy, y(x,)= Yo
we have
Y"=Ay'=hZy
Y"=hy"=A3y

y(P) =~ ~ ( p - 1=) hP
Y
Applying the p th order Taylor series method

to the test equation (36) , we get


Singlestep Methods
for Solving IVPs

where

(39)

For h > 0, E (Ah) < eAhfor all hh and therefore, the Taylor series method is always
relatively stable.
For h <-0. we obtain the intervals of absolute stability for different values of p.
p=l: I~(hh)(<Il+hh(<l
We get,
- 1 < l + h h < l or, - 2 < h h < O
Hence, the interval of absolute stability is ] - 2, 0[

We get,
-1 < 1+ hh +-hZh2< l 1
or, - 1 <-[(l+hh)> + l ] < l
2 2

The left inequality is always satisfied. From the right inequality, we get
(1+ hh12 + 1 < 2 or, (1+ ~ h < )l ~

Hence, the interval of absolute stability is ] - 2, 0 [

i It can be verified that Ah E (-2.5, 0)

It can be verified that hh €1 - 2.78, 0[


RUNGE-KUTTA METHODS
I Second order method
Applying the method (22) to the test equation
Y' = AY, y(xo)= Yo
We get,
K, = h f ( x i , y i ) = h h yi
Kz = h f ( x i + a , h , y i +P2, K , ) = hh (yi +P21K,)
=Ah (YI + P 2 , h2h2 yi)
= (hh + P2, h2h2)y i
and
YI+l = YI +~
l K +l wzKz
= y, + wlAhyl + w, [hh+p,, h2h2]yl

= [ l + ( w , + w , ) A h + w 2 P , , A2h2]Yl
Numerical Solutions
of ODES Using the conditions w, + w, = 1 and w, P2, = -1 (see Eqn.(25)), we get
2

k2h2
where E(Ah)=l+hh+-
2
For h > 0, E (Ah) < eAhfor all hh . Therefore, this method is relatively stable for all
Ah.
I
For h < 0, E (Ah) ( < 1 gives Ah E ] - 2,O[ . Hence, the interval of absolute stability
for second order Runge-Kutta method is ] - 2, 0[ .
Remark: The interval of absolute stability of all second order Runge-Kutta methods is
I-2,0[.
Fourth order method
Applyjng the method (29) to the test equation
Y' = LY, y(x0) = Yo
we get,
K, = h f ( x i , y i ) = h h yi

and
1
yi+,= y i +-(K, + 2K, + 2K3 + K,)
6

A2h2 h3h3 A4h4


where E(hh) =l+Ah+-+-+-
2 6 24
Since E (Ah) < e" , A > 0 , this method is relatively stable for all Ah .
I I -
For h < 0, E(Ah) c 1 gives the interval of stability as ] 2.78,0[.
Example 9: Find the interval of absolute stability for the second order Runge-Kutta Singlestep ~ e t b *
method (27). for Solving ~ V P S

solution: Applying the method (27) to the test equation


yr=Ay, Y(xO)=YO, 1 < 0
we get
K, = h f ( x , , y i ) = Ah yi
K , = h f ( x , + h , y i +K,)=Ah (yi +K,)
=hh(y, +Ah Y , )
=(Ah + h 2 h 2 )yi
and

h2h2
where E(Ah) = 1+ kh + -2
I 1
The condition E ( ~ h <) 1gives the interval of absolute stability as ] - 2, O[.

Example 10: The second order Runge-Kutta method is applied to the IVP
y' = -1ooy, y(0) = 1
Find the values of h so that the method produces stable results.
Solution: Comparing the given problem with the test equation y' = hy ,we get
A = -100.
1
1 I<
Since for stability : Ah 2 , we get lOOh < 2 or, h < -.
50

1
Hence, for 0 c h c - ,the method will produce stable results.
50
***
And now some exercises for you.
E12) Find the interval of absolute stability of the two stage Runge-Kutta method
P given by
1
Y i + l = Y i +-(K, +3K,)
4
where K, = h f ( x i , y i )

E13) Fourth order classical Runge-Kutta method is used to solve the initial value
problem
y' = -2OOy. y(0) = 1
Determine the value of h so that the method produces stable results.
We now end this unit by giving a summary of what we have covered in it.
-

Numerical Solutions
01 ODES 8.6 SUMMARY
In this unit we have discussed the following points
1. In sieglestep methods for solving IVP(4) viz.,
Y ' ( x ) = ~ ( x , Y ) , ~ ( x o ) = Y o , X E [ X O , bl
the solution value yi+, at,the nodal point xi+, is obtained by using the solution
value y, at only the previous point xi . Such a method is called an explicit
singlestep method and is written as
Y , + ~= yi + h Q , ( x i ,yi,h), i =(),I,...
where h is the step size and Q, is called the increment function. If the method
also uses the solution value yi+,, then the method is called an implicit
singlestep method.
2. Taylor series method of order p for the solut~onof the IVP(4) is given by

yi+, = Yi h 2 " +...+-Yi


+ h yi, +-Yi hP (PI
2! P!
where, x i = x , + i h , i=0,1,2 ..., N, x, = b a n d y , isanapproximationto
y(xi) . The error of approximation is given by

3. Euler's method is the Taylor series method of order one.


4. Taylor series method of order p for the system of first order IVP's(3) is given

T
where =[yli, Yzi,...,Yni I
T
(y(m))xi=[yi;), yF),..., y?'] , m = l , 2 ,... , P

5. A v -stage Runge-Kutta method for the solution of IVP(4)


Y' = f ( ~ , ~yl(xo)=
)r Yo, X ~ [ ~ o , b l

wherethemeshpointsare x, = x , + i h , i=O,l, ..., n, x, = b = x , + n h , is


obtained by writing
y ,+, = y, + h (weighted sum af the slopes)

1=1
where v slopes are used. These slopes are defined by
i-l
x i + a i h, y i + C p i j ~, , =
j=l
I , ,v ai *O

The unknowns a i,Pij and w are then obtained by expanding K i 's and y ,+, in
Taylor series about the point ( x i ,y ) and comparing the coefficients of
different powers of h .
6. Unlike Taylor series methods, Runge-Kutta methods do not need calculation
of higher order derivatives of f(x, y) but need only the evaluation of f(x, y) at
the off-step points.
7. The numerical solution y which is an approximation of y(xi ) contains
errors. The error at the nodal point x i is given by
Slnglestep Methods
Ei=Y(%)-Y; for Solving IVPs
and'is called numerical error. If this error remains bounded as
i -+ a (or h t0), then the numerical method is said to be stable.
8. When a numerical method is applied to the following linearised form
of IVP(4), (test equation)
= Yor X~[xo,bI
yl=&.Y, Y(XO)
with nodal points x, = x, + ih, i = O,1,. ..,N and x, = b = x, + Nh , a relation
of the form
Y i+l = E (Ah) Y
is obtained where E(hh) is some approximation to e" . The error ei+,at the
nodal point xi+, consists of two parts and is given by

The first part E(hh) - eAhis the local truncation error and the second part
E(Ah) ei is called the propagation error and the following results hold
i) numerical method is called absolutely stable if
IE(hh)l<l, h < O
In this case y, -+ 0 as i -+ a, . The set of values of Ah which satisfy
the above condition give the interval of absolute stability ]Ah, 0[ for the
given method. If this interval is ] - a,0 [ , then the method is called A-
stable.
ii) numerical method is called relatively stable if
E(Ah) < eA",h > 0
and the set of values of hh which satisfy the above condition give the
interval of relative stability.

8.7 SOLUTIONSIANSWERS
El) x , = l , y , = l , yb=-l
y, = y(l.I)= yo + h y b =1+(0.1) (-l)=0.9
x, = l . l , y, =0.9, yl =-0.81

x, =0.2,y, = 1 . 8 2 , ~=5.86,y:
;
-
y z = y ( 1 . 2 ) = ~ +, h y ; =0.9+(0.1) (-0.81)=0.819.

E2) a) x, =O,y, = 1,yb =3,y: = l l ; y, y(0.2)=1.82.


= 19.58, y 2 ~ ( 0 . 4 1 ~ 3 . 3 8 3 6 .

b) x, = 0, y, = 1, y i = 3, y: = 11, y: = 3 3 , ~ : = 99,
y, z y(0.2) = 1.8706.
x, = 0.2, y , = 1.8706, y; = 6.01 18, yy = 20.0354, y:= 60.1062,
yy = 180.3186, yz = y(0.4) = 3.5658.
E3) a) x,=1,yo=l,y~=1.841471,y~=1.540302,y,=y(l.l)=1.191849.
x , = l . y, =1.191849, y; =2.029055, yy=1.369943,
y2 5 y(1.2) = 1.401604
b)
-
x o = 1 , y o = 1 , y ~ = 1 . 8 4 1 4 7 1y%=1.540302,~:=-,841471,
y: = -0.540302, y, ~ ( 1 . 1=
I
) 1.191706.
,

x , = .l, y , = 1.191706, y; = 2.029002, Y: = 1.370076,


y;= -0.929002, yl' = -0.370076, y? = ~ ( 1 . 2 =
) 1.401300.
Numerlcal Solutions
of ODES

E l l ) y; = y 2 ,~ , ( 0 ) = 1Y;; = -3 y ,2, y,(O)=l.


2
X o =O, Y," = I , Y20 =1
T T
K , =[0.2, 0.31 , K 2 =[0.23, 0.3631 ,
T
K, =[0.2363, 0.37483817. K 4 =[0.274968,04585311 .,
T T T Slnglestep Methods
[y,,, y,,] = [y, (0.2), y,(0.2)] = [1.234595, 1.3723681 . for Solving lVPs
X , =0.2, y,, =1.234595, y,, =1.372368,

K , = (0.274474, 0.457267)T, K, = [0.320200, 0.56457717,


K, =[0.330931, 0.5835521, K, = 10.391184, 0.73526117,
T T
[y,,, y2, r [y,(0.4), y2(0.4)) = [1.562582, 1.9538321 .
E12) Apply the method to the test equation
y' = hy, h < 0, we get

From I ~ ( h h ) I < lweget


, -2<hh<0.
El 3) Comparing the given problem with the test equation y' = hy , we get h = -200.
I 1
For stability, we require Ah ( < 2.78. Therefore, - 200h < 2.78 or, 1
h ~0.0139.
-X-
Numerica1 Solutions
of ODES PRACTICAL ASSIGNMENTS
Session 1:

1. Write a program using Euler's method to solve the initial value problem
y = f (x, y), y(xo) = yo . Input the step length h and the number of steps of
integration. Test your program on exercise El).

2. Write a program using Taylor series method of second order to solve the initial
value problem y' = f (x, y), y(x,) = yo . User shall give the expression for y" .
Input the step length h and the number of steps of integration. Test your program
on exercises E2) and E3).

3. Write a program using Runge-Kutta second order method to solve the initial value
problem y' = f(x, y), y(xo ) = yo . Input the step length h and the number of
steps o f mtegration. Test your program on exercises E6) and E7).

4. Write a program using fourth order classical Runge-Kutta method to solve the
,
initial value problem y ' = f (x, y) , y(x ) = yo . Input the step length h and the
number of steps of integration. Test your program on exercises E8) and E9). i

You might also like