You are on page 1of 19

CHAPTER 5

Ordinary Differential Equations


Initial Value Problems : An ordinary differential equation is a relation between a
function , its derivatives, and the variable upon which they depend. The most general
form of an ordinary differential equation is given by
(t , y, y1 , y n ,..... y ( m ) ) = 0

(6.1)

Where m represents the highest order derivative, and y and its derivatives are functions
of t. The order of the differential equation is the order of its highest derivative and its
degree is the degree of the derivative of the highest order after the equation has been
rationalized in derivatives. If no product of the dependent variable y(t) with itself or
any one of its derivatives occur, then the equation is said to be linear, otherwise it is
nonlinear. A linear differential equation of order m can be expressed in the form
m

p =0

(t ) y ( p ) (t ) = r (t )

(6.2)

In which p ((t ) are known functions. If the general nonlinear differential equation (6.1)
of order m can be written as

(6.3)

y ( m ) = F (t , y, y1 , y n ,..... y ( m 1) )

Then the equation (6.3) is called a canonical representation of the differential equation
(6.1). In a such form ,the highest order derivative is expressed in terms of the lower
order derivatives and he independent variable.
Initial value problem:
A general solution of an ordinary differential equation such as(6.1) is a relation between y,
t and m arbitrary constants , which satisfies the equation, but which contains no
derivatives. The solution may be an implicit relation of the form

w(t , y, c1 , c2 ,...cm ) = 0

(6.4)

y = w((tt , c1 , c2 ,...cm ).
)
O an explicit
Or
li i function
f
i off t off the
h form
f

(6.5)
(6 5)

The m arbitrary constants c1 , c2 ,...cm can be determined by prescribing m conditions of


the form

y ( v ) (t0 ) = v , v = 0,1,2,,.....,, m 1

((6.6))

At on point t = t0 , which are called initial conditions. The point t 0 is called the initial
point. The differential equation (6.1) together with the initial conditions (6.6) is called an
mth order initial value problem.
If the m conditions are prescribed at more than one point to determine the m arbitrary
constants In the general solution (6.1)
(6 1) together with the boundary conditions is known as
the boundary value problem .

EULER METHOD:
u j +1 u j

tj,

= f (tas
j ,u j )

we write h
(6.58)
u j +1 = u j + hf j , j = 0,1,2,......, N 1
where f j = f (t j , u j ). This is called the Euler method. Applying the method at the mesh
points

j=0,1,2,.,N-1 , we obtain the numerical solution of (6.8) as


u1 = u0 + hf 0
u2 = u1 + hf1
....................
u N = u N 1 + hf N 1

Choosing a suitable value of h and the initial condition, u1 is obtained from the first
equation , u2 is obtained from the second equation and so on. The method (6.58) is called
an explicit method , since using u j , h

and f j we can calculate u j +1 directly. The

Euler method is the simplest method to solve (6.8).

The truncation error in the method is given by


T j +1 = u (t j +1 ) u j +1
h 2 ''
= u (t j +1 ) [u (t j ) + hf (t j , u j )] = u ( )
2

Where t j < < t j +1. If we denote

max
[ t 0 ,b ]

T j + 1 = Tand

max u ( )
''

[ t o ,b ]

= M 2 , thenwehave

h2
T
M
2

2.

(6 59)
(6.59).
5

The local truncation error is of O (h 2 ) h 0 .


Example 6.9:
Use the Euler method to solve numerically the initial value problem.

u ' = 2 tu

, u (0 ) = 1

With h=0.2,0.1 and 0.05 on the interval [0.1].Neglecting the round off errors, determine the bound for
the
h error. Applying
l
Richardsons
h d extrapolation
l
to improve the
h counted
d value
l u(1.0).
( )
We have
2

u j +1 = u j 2ht j u j ; j = 0,1,2,3,4

With h=0.2 . The initial condition gives u0 = 1.


For j=0: t 0 = 0, u0 = 1
U(0.2) u1 = u 0 2ht 0u 02 = 1.0.
For j=1: t = 0.2, u = 1
1
1

u (0.4) u2 = u1 2ht1u12
= 1 2(0.2)(0.2)(12 ) = 0.92.
For j=2 :

t 2 = 0.4, u2 = 0.92
u (0.6) u3 = u2 2ht 2u22
= 0.92 2(0.2)(0.4)(0.92) 2 = 0.78458.

Similarly , we get u ( 0 .8 ) u 4
Wh h
When
h=0.1
0 1 , we get
For j=0 : t = 0 , u = 1
0

= 0 . 63684 , u (1) u 5 = 0 . 50706 .

u ( 0 . 1) u 1 = u 0 2 ht 0 u 02 = 1 . 0

For j=1 : t1 = 0 . 1, u 1 = 1

u ( 0 . 2 ) u 2 = u1 2 ht 1u12
= 1 2 ( 0 . 1)( 0 . 1)(1) 2 = 0 . 98 .
For j=2 : t 2 = 0.2, u2 = 0.98
u (0.3) u3 = u2 2ht 2u22
= 0.98 2(0.1)(0.2)(0.98) 2 = 0.94158.
Similarly, we get

u (0.4) u4 = 0.88839, u (0.5) u5 = 0.82525.


u (0.6) u6 = o.75715, u (0.7) u7 = 0.68835,
u (0.8) u8 = 0.62202, u (0.9) u9 = 0.56011,
u (1.0) u10 = 0.50364.

F h
For
h=0.05,
0 05 we gett u (0.05) 1.0, u (0.1) 0.995,
u (0.15) 0.9851, u (0.2) 0.97054,
u (0.25) 0.9517, u (0.3) 0.92906,
u (0.35) 0.90316, u (0.4) 0.87461,
u (0.45) 0.84401, u (0.5) 0.81195,
u (0.55) 0.77899, u (0.6) 0.74561,
u (0.65) 0.71225, u (0.7) 0.67928,
u (0.75) 0.64698, u (0.8) 0.61559,
u (0.85) 0.58527, u (0.9) 0.55615,
u (0.95) 0.52831, u (1.0) 0.50179.

The truncation error in the Euler method is given by


h2
TE = u ' ' ( )
2
h2 n
h2
TE =
u ( )
2
2

max u

(t ) .

0 t 1

Since the exact solution is u(t) = 1/(1+ t 2 ).


) we get
h2
TE
2

max
0 t 1

2(1 3t 2 )
2h 2
2 3
(1 + t )

2
As the absolute maximum of (1 3t ) in[0,1] is 2.

The error in Euler method is of the form

u (t j ) u j (h) = c1h + c2 h 2 + c3 h 3 + ....

Richardsons extrapolation gives

u ( k ) ( h) =

2k u j

( k 1)

(h / 2) u (jk 1) (h)
2k 1

Backward Euler Method:


u u

The
h equation at j j 1 = f (t j , u j ) the
h mesh
h point t = t j +1 may b
be written as u j +1 = u j + hf j +1 ((6.60))
h
where
f j +1 = f (t j +1 , u j +1 ) . This is called the Backward Euler Method . The solution values

u1 , u 2 , u3 ,....u j +1 are determined from the following equations

u1 = u0 + hf1

u 2 = u1 + hf 2
...................
u N = u N 1 + hf N

The method (6.60) involves the unknown value u j +1 on both sides of the equation and hence u j +1
i li i l SSuch
implicitly.
h a method
h d iis called
ll d an implicit
i li i method.
h d
Since f(t,u) is nonlinear,(6.60)produces a nonlinear algebraic equation for the solution of u j +1 . For the
solution of this nonlinear equation, we can use the NewtonRAPHSON METHOD . Applying the Newton
Raphson method to (6.60). We get

ff

u (js++11) = u j + h f (t j +1 , u (js+)1 ) + (u (js++11) u (js+)1 )


u

Or after rearrangement as

f ( s +1)

(u j +1 u (js+)1 ) = u j u (js+)1 + hf (t j +1 , u (j s+)1 )


1 h
u

(6 61)
(6.61)
9

Where

u (j s+)1 is the sth iterate of u j +1and

(s +1)
j+1

(s)
j+1

TOL

f is evaluated at ( t j +1 , u (j s+))1 . We iterate (6.61) until


u
((6.62))
du

= f (t , u ), u (t0 ) = 0
Where TOL is a specified absolute error tolerance. Since the solution u(t) of
dt
Varies continuously, we may take the initial approximation as u 0 = u The local truncation error at the
j +1
j
point t = t
p
in the method(6.60)
(
) is ggiven byy
j +1

T j +1 = u ( t j +1 ) u j +1
= u ( t j +1 ) [ u ( t j ) + hf ( t j +1 , u ( t j +1 ))]
h2
=
u ' ' ( ), t j < < t j +1 .
2

(6.63)

It may be noted that the truncation errors of Euler and backward Euler methods are equal but are of
opposite signs.
Example 6.12 : Solve the initial value problems
u= 2 tu 2 , u ( 0 ) = 1
with h=0.2 , on the interval [0,0.4],using the backward Euler method.
The backward Euler method gives
2

u j +1 = u j 2ht j +1u j +1 , j = 0,1

This is an implicit equation in u j + 1 and can be solved by using an iterative method. We generally use
NewtonRaphson method.
2
Denote F( u j +1 )=u j + 1 u j +0.4 t j + 1 +u j +1
10

We have

F ' ( u j + 1 ) = 1 + 0 . 8 t j + 1u j + 1
u (j s++11 ) = u (j s+)1

F ( u (j s+)1 )
F ' (u

(s)
j +1

s = 0 ,1, 2 ,.....( 6 . 64 )

(0)
Taking u j +1 = u j, we obtain from (6.64), for
J=0 t1 = 0.2, u1( 0 ) = u0 = 1,
J=0,

F (u1( 0) ) = 0.08, f ' (u1( 0) ) = 1.16, u1(1) = 0.93103448,


F (u1(1) ) = 0.00038050, F ' (u1(1) ) = 1.14896552, u1( 2 ) = 0.93070332,
F (u1( 2) ) = 0.14 *10 7 , f ' (u1( 2) ) = 1.14891253, u1( 3) = 0.93070331,

Therefore , u(0.2)

= 0 . 93070331

j = 1 : t 2 = 0.4, u2( 0 ) = u1 = 0.93070331,


F (u2( 0 ) ) = 0.13859338, F ' (u2( 0 ) ) = 01.29782506, u2(1) = 0.82391436,
F (u2(1) ) = 0.00182463, F ' (u2(1) ) = 1.26365260, u2( 2 ) = 0.82247043,
F (u2( 2 ) ) = 0.00000034, F ' (u2( 2 ) ) = 1.26319054, u 2( 3) = 0.82247016,
F (u2( 3) ) = 0.40 *10 8, F ' (u2(3) ) = 1.26319045, u2( 4) = 0.82247016.

Therefore , u(0.4) = u 2 =0.82247016.


The exact values are u(0.2)=0.96153846,u(0.4)=0.86206897.

11

MID POINT METHOD:


The equation

u j +1 u j 1

2h

= f (t j , u j )

may be written as u j +1 = u j 1 + 2hf j , j = 0,1,2..., N 1. (6.65)

This is called the midpoint method. The solution values are given by

u2 = u0 + 2hf1
u3 = u1 + 2hf 2
....................
u N = u N 1 + 2hf N 1

(6.66)
The value is u1 known from the initial condition. The value u1 is unknown and has to be determined
by some other method after which (6.66) is used to determine successively u 2 , u 3 ,.... u N .
The local truncation error is given by T j +1 = u (t j +1 ) u j +1
= u (t j +1 ) [u j 1 + 2hf (t j , u (t j ))]
h3
= u ' ' ' ( ),
) t j 1 < < t j +1.
3

3
The bound on the truncation error is given by T h M 3
J +1

Where

M3 = maxu' ' ' (t ) .

(6 67)
(6.67)
(6.68)

t[t0 ,b]

12

Example 6.13: Solve the initial value problem


u ' = 2 tu 2 , u ( 0 ) = 1

Using the mid point method,


method with h=0.2,over
h=0 2 over the interval [0,1]
[0 1] . Use the Taylor method of second order to
compute u(0,2). Determine the percentage relative error at t=1.
The midpoint method gives
(6.69)
u j + 1 = u j 1 4 ht j u 2j = u j 1 0 . 8 t j u 2j , j = 1, 2 , 3 , 4
We calculate

from
u 1 the Taylor series method of second order. We have
h2
u1 u (h) = u (0) + hu ' (0) + u ' ' (0)
2

Where

u(0) =1,u'(0) =0,u''(0) =. 2

We obtain

u1 u ( 0 .2 ) = 1 + 0 +

Now we obtain from (6


Now,
(6.69),
69)

0 .04
( 2 ) = 0 .96 .
2

have
have, for
u2,u3,u4,uWe
5.

j = 1 : u 0 = 1, u 1 = 0 . 96 , t1 = 0 . 2 ,
u ( 0 . 4 ) u 2 = u 0 0 . 8 t1u 12 .
= 1 ( 0 . 8 )( 0 . 2 )( 0 . 96 ) 2 = 0 . 852544 .
j = 2 : u 1 = 0 . 96 , u 2 = 0 . 852544 , t 2 = 0 . 4 ,
u ( 0 . 6 ) u 3 = u 1 0 . 8 t 2 u 22 .
= 0 . 96 ( 0 . 8 )( 0 . 4 )( 0 . 852544 ) 2 = 0 . 7274139 .
j = 3 : u 2 = 0 . 858544 , u 3 = 0 . 7274139 , t 3 = 0 . 6
u ( 0 . 8 ) u 4 = u 2 0 . 8 t 3 u 32
0 . 852544 4 ( 0 . 2 )( 0 . 6 )( 0 . 7274139 ) 2 = 0 . 5985611 .
j = 4 : u 3 = 0 . 7274139 , u 4 = 0 . 5985611 , t 4 = 0 . 8 ,
u (1 . 0 ) u 5 = u 3 0 . 8 t 4 u 42

13
= 0 . 7274139 ( 0 . 8 )( 0 . 8 )( 0 . 5985611 ) 2 = 0 . 4981176

The exact solution is

u ( t ) = 1 /(1 + t 2 ). Therefore

, u(1)=0.5.

*
The percentage error is defined as p.e = u u *100

*
Where u is the exact solution and u is the approximate solution. Therefore:

p.e =

0.5 0.4981176
*100= 0.38%.
0.5

14

6.4 SINGLESTEP METHODS:


The method for the solution of the initial value program

u' = f (t,u),u(t0 ) =0,t [t0,b]

(6.70)
Can be classified mainly into two types. They are (1) single step methods and (2) multistep methods.
In single step methods
methods, the solution at any point is obtained using the solution at only the previous point
point.
Thus, a general single step method can be written as
uj+1 = uj + h(t j+1, t j , uj+1, uj , h)
(6.71)
Where is a function of the arguments t j , t j +1 , u j , u j +1 , h and also depends on f.
f We often write it as
(t, u, h) . This function is called the increment function . If u j + 1 can be obtained simply by evaluating
the right hand side of (6.71) , then the method is called an explicit method . In this case , the method is
of the form

u j +1 = u j + h (t j , u j , h).

(6.72)

If the right hand side of (6.71) depends on u j +1 also, then it is called an implicit method. The general
form in this case is as given in (6.71).

15

Taylor Series Method:


The fundamental numerical method for the solution of (6.70) is the Taylor series method.
We assume that the function u(t) can be expanded in Taylor series about any point t j ,that is
1
u(t ) = u(t j ) + (t t j )u' (t j ) + (t t j )2 u' ' (t j ) + ....
2!
1
1
+ (t t j ) p u( p) (t j ) +
(t t j ) p+1u( p+1) (t j +h).
)
( p +1)!
p!

This expansion holds for

(6.75)

t[t0,b]and 0< <1.

Substituting t = t j +1 in (6.75) , we get

h2
1 p ( p)
u ( t j + 1 ) = u ( t j ) + hu ' ( t j ) +
u ' ' ( t j ) + ... +
h u (t j )
2!
p!
1
h p + 1u ( p + 1 ) ( t j + h )
+
( p + 1)!
1
= u ( t j ) + h ( t j , u ( t j ), h ) +
h p + 1u ( p + 1 ) ( t j + h )
( p + 1)!

h2
h p ( p)
Where h(t j , u(t j ), h) = hu' (t j ) + u' ' (t j ) + ...... u (t j ).
2!
p!

16

Denote by h(t j , uj , h) , the value obtained from h (t j , u (t j ), h ) by using an approximate value u j


In place of the exact value u (t j ) . Neglecting the error term, we have the method
(6 76)
(6.76)
u j +1 = u j + h ( t j , u j , h ),
) j = 0 ,1, 2 ,3 .... N 1
to approximate

u ( t j +1 ) .

The error or the truncation error of the method is given by


1
T j +1 =
h p +1u p +1 (t j + h)
(6 67)
(6.67)
( p + 1)!
The method (6.67) is called the Taylor series method of the order p . Substituting p=1 , in (6.76) we get
u j +1 = u j + hu ' = u j + hf (t j , u j )

which is the Euler method


method. Therefore , Euler method can also be called as the Taylor series method of
order 1 .
u( p) (t j ).If t j and u (t j ) are known, then
To apply (6.76) , it is necessary to know u(t j ),u'(t j ),.....
the derivatives can be calculated as follows :
First the known values t j and u (t j ) are substituted into the differential equation to give
First,
u ' (t j ) = f (t j , u (t j )). Next , the differential equation u=f(t,u) is differentiated to obtain expressions for the
higher order derivatives of u(t) .Thus , we have
u' = f (t, u)

u' ' = ft + ffu


u' ' ' = ftt + 2 fftu + f 2 fuu + fu ( ft + ffu )

..........................................................
Where

f t , f u ..... represents the partial derivatives of f with respect to t and u and so on. The values
17

can be computed by substituting t = t j . Therefore, if


then (6.76) can be compute u j +1 with an error

t j and u (t j ) are known exactly ,

h p +1 ( p +1)
u
(t j + h)
( p + 1)!
The number of terms to be included in (6.76) is fixed by the permissible error. If this error is
series is truncated at the term u ( p ) (t j ) then
h p +1 u ( p +1) (t j + h) < ( p + 1)!
Or
(6.78)
h p +1 f ( p ) (t j + h) < ( p + 1)!
We assume that an estimate of f ( p ) (t + h is known.

and the

Foe a given h and ,(6.78) will determine p, and if p and are specified ,then it will give an upper
bound on h.
Since t j + h is not known, f ( p) (t j + h) in (6.78) is replaced by its maximum value in [t0 , b] . A way of
determining this value is as follows. Write one more nonvanishing term in the series than is required and
then differentiate this series p times. The maximum value of this quantity in [t0 , b] gives a rough required
bound.

18

Example 6.15 :
Given the initial value program u ' = t 2 + u 2 , u(0)=0
u(0) 0
Determine the first three nonzero terms in the Taylor series for u(t) and hence obtain the value for u(1) .
Also determine t when the error in u(t) obtained from the first two nonzero terms is to be less than
10 6 after rounding.
We have u(0)=0,u(0)=0
u=2t+2uu,u(0)=0
((u ' ) 2),
u=2+2(uu+
(
),u(0)=2
( )
u ( 4 ) = 2(uu ' ' '+3u ' u ' ' ), u ( 4) (0) = 0
u (5) = 2[uu ( 4 ) + 4u ' u ' ' '+3(u ' ' ) 2 ], u (5) (0) = 0
u ( 6 ) = 2(uu (5) + 5u ' u ( 4 ) + 10u ' ' u ' ' ' ), u ( 6 ) (0) = 0
u ( 7 ) = 2(uu ( 6) + 6u ' u (5) + 15u ' ' u ( 4 ) + 10(u ' ' ' ) 2 ), u ( 7 ) (0) = 80
u (8) (0) = u (9 ) (0) = u (10) (0) = 0
u (11) = 2[uu (10) + 10u ' u ( 9 ) + 45u ' ' u (8) + 120u ' ' ' u ( 7 )
+ 210u ( 4)u ( 6) + 126(u (5) ) 2 ],
] u (11) (0) = 38400

12 1 7
2 11
t . The approximate value of u(1) is given
Thus , the Taylor series for u(t) becomes u(t) = t + t +
3
63
2079
by u (1) = 1 + 1 + 2 0.350168 . If only the first two terms are used , then the value of t is obtained from
3

63

2079

2 11
t < 0.5 *107 .solving we get
2079

t 0.41.
19

You might also like