Ordinary Differential Equations Taylor's series(point­wise method) What is Differential Equation? The Taylor's series expansion of y(s) about 

Ordinary Differential Equations
What is Differential Equation?
An differential equation or Ordinary differential equation that involves one or more derivatives of an unknown function.
Taylor's series(point­wise method)
The Taylor's series expansion of y(s) about x=x0 is given by
y(x)=y(x0)+(x­x0)y'(x0)+
or
What is solution to DE?
A solution of a differential equation is a specific function that satisfies the equation.
What is initial value problem?
A problem with the given condtion or initial value.
Why initial value?
 x−x 0 2
y''(x0)+...
2! 
y(x0+h)=y(x1)=y1
=y0+
h
h2
h3
y0'+
y0''+ y0''+...
1 !
2 !
3 !
In general, if hn+1 and higher power of h are omitted then the error will be proportional to (n+1)th power of the step size.
That is, khn+1, k is step size.
An arbitrary contant in the solution of DE Problem 01:
indicate that a DE does not, in general, dy
determine a unique solution function. For Using Taylor's series solve =1+xy with dx
this reason, a DE is usually accompanied by y(0)=2. Find y(0.1), y(0.2) and y(0.3)
auxiliary conditions that specify the unknown functin precisely.
Solution:
In this chapter, we concentrate on one type of differential equation and one type of auxiliary condition: the initial value problem for a first order differential equation.
The standard form adopted is dy
=f x , y  with initial conditon y  x 0 =x 0
dx
the Taylor's series(1st app.,) is y1=y0+
h
h2
h3
y0'+
y0''+ y0''+...
1 !
2 !
3 !
here intial condition arex0=0, y0=2 and h=0.1 given y'=1+xy
y''=y+xy
y'''=y'+y'+xy'' = 2y'+xy''
The above system will yield the solutions in for the first approximation, substitute (x0, y0)in the above derivatives.
one of the two forms:
1. A series for y interms of powers of x, That is,
from which the value of y can be y0'=1+x0y0=1+0*2=1
obtained by direct substitution.
y0''=y0+x0y0'=2+0*1=2
2. A set of tabulated values of x and y.
y0'''=2y0'+x0y0''=2*1+0*1=2
The methods of Taylor and Picard belong to substitute these values in Taylor's series of class (1), whereas Eulter, Runge­Kutta 1st approximation
belongs to class(2).
PES College, PESIT Campus, Department of BCA
1
Ordinary Differential Equations
y1=y0+
h
h2
h3
y0'+
y0''+ y0''+...
1 !
2 !
3 !
0.1
0.12
0.13
=2+
+
∗2 +
∗2
1 !
2 !
3 !
0.1
0.12
1.4486+
2.53272+ 1 !
2 !
y3=2.2430+
0.13
3.4037
3 !
 y(0.3)=2.4011
=2.1103
 y(0.1)=2.1103
Problem 02:
nd
The Taylor's algorithm for the next(2 ) approximation is
y2=y1+
h
h2
h3
y1'+
y1''+ y1''+...
1 !
2 !
3 !
here x1=x0+h=0+0.1=0.1
Solution:
Taylor's algorithm is,
y1=2.1103
y1'=1+x1y1=1+(0.1)*2.1103=1.21103
y1=y0+
y1''=y1+x1y1'=2.1103+0.1*(1.21103)=2.2314
y1'''=2y1'+x1y1''=2*(1.21103)+0.1*2.2314=2.6452
substitute these values in Taylor's series of 2nd approximation
2
0.1
0.1
y2=2.1103+
1.21103+
2.2314+ 1 !
2 !
0.13
2.6452
3 !
 y(0.2)=2.2430
h
h2
h3
y0'+
y0''+ y0'''+...
1 !
2 !
3 !
here x0=0, y0=0, h=0.1
y'=1­2xy
y''=­2[ y­xy' ]
y'''=­2[ y'+y'+xy'' ]=­2[ xy''+2y' ]
y0'=1­2x0y0
= 1
y0''=­2[ y0­x0y0' ] = 0 y0'''=­2[ x0y0''+2y0' ] =­4
rd
The Taylor's algorithm for the next(3 ) approximation is
y3=y2+
Using Taylor's method, find y(0.1) correct to dy
2xy=1, y 0 =0
3 decimal places from dx
2
3
h
h
h
y2'+
y2''+ y2''+...
1 !
2 !
3 !
substitute above values in taylor's 1st approximation formula
y1=1+0.1+
2
3
0.1
0.1
0+ x­4 = 0.0993
2 !
3 !
here x2=x1+h=0.1+0.1=0.2
Exercise:
y1=2.2430
Using Taylor's find y at x=1.1 and 1.2 by dy 2
2
=x  y given y(1)=2.3
solving dx
y2'=1+x2y2=1.4486
y2''=y2+x2y2'=2.53272
y2'''=2y2'+x2y2''=3.4037
substitute these values in Taylor's series of 3rd approximation
PES College, PESIT Campus, Department of BCA
Ans: y(1.1)=3.1209
y(1.2)=4.6823
2
Ordinary Differential Equations
Picard's Method

2
4
3
= 1 x x − x − x
2 3∗4  3
In this method, to solve dy
=f x , y  with initial conditon y  x 0 =x 0
dx
= 1x
x
∫ f  x , y  dx
integrate y=y0+
x

0
x 2 x 4 x3
− −
2 12 3
x
rd
(3)
3 approximation y =y0+
x0
x0
x
the 1st approximation y(1)=y0+
∫ f  x 0, y 0 dx
x0
x

∫ f  x 0, y
 1
0
y =1+
x
3rd approximation y(3)=y0+
x
dx
x0
∫ f  x 0, y02 dx
x0
and so on.
∫  y02−x 2  dx
(3)
x
2nd approximation y(2)=y0+
∫ f  x 0, y02 dx
= 1 + ∫
0
[
0
1x
y(3) = 1x
 ]
x2 x 4 x3
− − −x 2 dx
2 12 3
x2 x3 x4 x5
− − −
2 6 12 60
put x=0.1 in the above equation,
Problem 03:
y(0.1)=1+(0.1)+
0.1 2 0.1 3 0.1 4 0.15
−
−
−
2
6
12
60
dy
= y−x 2 , y(0)=1 by Picard's = 1.1048249
dx
method upto the third approximation. Hence put x=0.2 in the above equation,
find the value of y(0.1) and y(0.2).
0.2 2 0.2 3 0.24 0.25
y(0.2)=1+(0.2)+
−
−
−
2
6
12
60
Soultion:
= 1.218528
Given that x0=0, y0=1 and f(x,y)=y­x2.
Solve x
st
(1)
1 approximation y =y0+
∫ f  x 0, y 0 dx
x0
∫ 1−x 2 dx
0
x
 
x3
x−
3
= 1 + = 1x−
0
x3
3
x
2nd approximation y(2)=y0+
∫ f  x 0, y01 dx
x0
x
(2)
 y =1+
∫  y 1−x 2 dx
0
x
= 1+
∫
0
[
1x−
dy
=x y 2 , y(0)=1 by dx
Picard's method upto the 2nd approximation. Hence find the value of y(0.1). [ans: 1.1156255]
1. Solve x
 y(1)=1+
Exercise:
 ]
x3
−x 2 dx
3
PES College, PESIT Campus, Department of BCA
dy
=x y , y(0)=1 by Picard's dx
method. Hence find the value of y(0.1)&y(0.2) 2. Solve dy
=2x− y , y(1)=3 by dx
Picard's method. Hence find the value of y(1.1). 3. Solve Note: if the level of approximatiion is not given, assume it according to the marks.
3
Ordinary Differential Equations
Euler's Method
The Euler's Successive approximation to solve y'=f(x,y) with the initial conditions y(x0)=y0 are as follows:­
dy
=1xy with initial condition dx
x0=0 and y0=2.
Given DE The Euler's formula for 1st approximation is y1=y0+ h f(x0, y0)
y1=y0+ h f(x0, y0)=2+ 0.1 (1+xy)
y2=y1+ h f(x1, y1), ...
=2+0.1*(1+0) = 2.1
In general, that is, x1=0.1 and y1=2.1.
yn+1=yn+ h f(xn, yn), n=0,1,2, ...
y2=y1+ h f(x1, y1)=2.1+0.1*(1+0.1*2.1)
Problem 04:
=2.221
dy
=1− y , y(0)=0 at x­0.1 and x=0.2 that is, when x1=0.2 and y1=2.221
Solve dx
using Euler's method.
y3=y2+ h f(x2, y2)=2.221+0.1*(1+0.2*2.221)
Solution:
dy
=f x , y  is The solution of dx
=2.36542
that is, y(0.3)=2.36542
yn+1=yn+ h f(xn, yn)
dy
=1− y with initial conditon Modified Euler's Method
dx
is x0=0, y0=0 and h=0.1
For a reasonable accuracy, we need to take a small value for h and hencethe process y1=y0+ h f(x0, y0)=0+0.1(1­0)=0.1
will become very slow. Because of this y2=y1+ h f(x1, y1)=0.1+0.1(1­0.1) = 0.19
restriction on h, the method is not suitable for practical use and a modification of it, hence y(0.1)=0.1
known as the modified Euler's method, y(0.2)=0.19
which gives more accurate reslts.
Given DE is Problem 05:
dy
=1xy
dx
with y(0)=2. Find y(0.1), y(0.2) and y(0.3). Using Euler's method solve Solution:
The solution of dy
=f x , y  is dx
yn+1=yn+ h f(xn, yn) PES College, PESIT Campus, Department of BCA
In Modified Euler's method, instead of approximating f(x,y) by f(x0,y0), we 1
approximating it by [f  x 0, y 0f  x 1, y 1] , 2
which is the mean of the slopes of the tangents at the points corresponding to x=x0 and x=x1. Thus we obtain
h
y1(1)= y 0 [f  x0, y 0 f  x 1, y 1]
2
In general,
h
 n
y1(n+1)= y 0 [f  x0, y 0 f  x 1, y 1 ]
2
4
Ordinary Differential Equations
Problem 06:
Using modified Euler's method solve dy
=1xy with y(0)=2. Find y(0.1), y(0.2) dx
and y(0.3). Now find y(0.2):
h
y2(1)= y 1 [f  x 1, y 1 f x 2, y 2 ] ... (2)
2
here x1=0.1, y1=2.1105
x2=x1+0.1=0.2, y2 find using Euler's method.
Solution:
That is,
The first approximation is
y2=y1+ h f(x1, y1)
h
y1(1)= y 0 [f x 0, y 0 f  x 1, y 1 ] ...(1)
2
=2.1105+0.1 * (1+x1y1)
here f(x,y)=1+xy
=2.2316
 f(x0,y0)=1+x0y0=1+0*2=1
=2.1105+0.1 * (1+0.1*2.1105)
f(x1, y1)=(1+x1y1)=(1+0.1*2.1105)=1.21105
next f(x1,y1)
f(x2, y2)=(1+x2y2)=1+0.2*2.2316=1.4463
x1=x0+h=0+0.1=0.1
substitute these value in (2), we get
y1=?. We need to find y1 using Euler's method.
y2(1)= 2.1105
The Euler's formula for 1st approximation is =2.2434
y1=y0+ h f(x0, y0)=2+ 0.1 (1+xy)
continuiing this process, 0.1
[1.211051.4463 ]
2
=2+0.1*(1+0) = 2.1
y2(2)=2.2435
that is, x1=0.1 and y1=2.1.
y2(3)=2.2434
Again, f(x1,y1)=1+x1y1=1+0.1*2.1=1.21
y2(4)=2.2434
Now apply in equation (1),
y1(1)= 2
0.1
[11.21] =2.1105
2
h
 1
y1(2)= y 0 [f  x0, y 0 f  x 1, y 1 ]
2
f  x1, y 11 =1+x1y1(1)=1+0.1*2.1105
=1.21105
y1(2)= 2
0.1
[11.21105] =2.1105
2
therefore, the value of y2=2.2434
Similarly, find y(0.3). [Ans: y3=2.4018]
Exercise:
Given dy y 1
 = y 1=1.
dx x x 2,
Evaluate y(1.3) by modified Euler's method.
Hint: here x0=1, take h=0.1 [in case of 7marks question) and find when
since differentence between two successive x1=1.1 what is y1? [ans: y1=0.9960]
approximation is less than desired accuracy, x2=1.2 what is y2? [ans: y2=0.9857]
the final value of y1=2.1105 when x1=0.1
x3=1.3 what is y3? [ans: y1=0.9715]
PES College, PESIT Campus, Department of BCA
5
Ordinary Differential Equations
Runge­Kutta Method
The Taylor's series method of solving DE numerically is handicapped by the problem of find higher order derivatives.
Problem 07:
Compute y(0.1) and y(0.2) by RK method dy
2
=xy y , y(0)=1.
dx
Euler's method is less efficient in practical problems since it requires 'h' to be small for Solution:
The formulas for the forth order RK method obtaining resonable accuracy.
are
The Runge­Kutta methods do not require the calculations of higher order derivatives and k1=h f(x0, y0)
they are designed only the function values at k
h
k2=h f x 0 , y 0 1
some selected points on the subinterval.
2
2
These methods agree with Taylor's series k
h
solution upto the terms of hr where r is the k3=h f x 0 , y 0 2
2
2
order of RK method.


Runge Kutta(RK) II order


k4=h f  x 0h , y 0k 3 
1
(k1+2k2+2k3+k4)
6
k1=h f(x0, y0)
∆y=
k2=h f(x0+h, y0+k1)
given f(x, y)= xy+y2; x0=0; y0=1 and h=0.1
y1=y0+
1
 k k 
2 1 2
k1=(0.1) (0+1)=0.1

k2=(0.1) f 0
Runge Kutta IV order (referred as RK method) k1=h f(x0, y0)


k
h
k2=h f x 0 , y 0 1
2
2
k
h
k3=h f x 0 , y 0 2
2
2


k4=h f  x 0h , y 0k 3 
∆y=
1
(k1+2k2+2k3+k4)
6
then the 1st approximatiion is given by
y1=y0+∆y
Similarly, 2nd approximatiion is given by
y2=y1+∆y, where x1=x0+h & y0 by y1
In general, yn+1=yn+∆y, PES College, PESIT Campus, Department of BCA
0.1
0.1
,1
2
2

=f(0.05,0.05)
= (0.1) (0.05*0.05+(0.05)2)=0.1155

k3=(0.1) f 0
0.1
0.1155
,1
2
2

=f(0.05, 0.05775)=0.1172
k4=(0.1) f  x 0h , y 0k 3 
= (0.1) f(0+0.1, 1+0.1172)
= 0.1360
∆y=
1
(0.1+2(0.1155)+2(0.1172)+0.1360)
6
= 0.1169
Therefore, y(0.1)=1.1169
For 2nd approximatiion, we have x1=0.1; y1=1.1169 and h=0.1
k1=0.1359
k2=0.1582
6
Ordinary Differential Equations
k3=0.1610
k4=0.1889
∆y=0.1605
Therefore, y(0.2)=1.2774
Exercies:
1. Use RK method to find y(0.1) given dy
1
=
, y(0)=1 that dx  x y 
[Ans: 1.0914]
2. Find y(0.1), y(0.2) and y(0.3) given dy
=1xy , y(0)=2
that dx
[ans: 2.1086, 2.2416, 2.3997]
dy y 1
 = y 1=1. Evaluate dx x x 2,
y(1.1) [ans: 0.9957]
3. Given PES College, PESIT Campus, Department of BCA
7