3.4 Numerical Solution of Differential Equations
3.4 Numerical Solution of Differential Equations
3.4 Numerical Solution of Differential Equations
4 Numerical Solution of
Differential equations
NOTATION
Usually, the differential operation is denoted by
dy
y ' or
dx
In this part, we also use this notation as a
function in x and y, i.e.
dy
y ' f ( x, y ).
dx
2
(x1, y1)
(x0, y0)
x1 x0
h
y1 y0 hy0 '
(x, y)
(x, y)
1
(x, y)
1.5
yi 1 yi hy1 '
The formula of One-step Euler Method
NOTATION
The values of x to be considered can be denoted by
x a (h)b.
This notation means that we begin with x a and
add up h to the value of x in every calculation
of subinterval until reaching the last value at x b.
Example 3.14
x 1(0.2)3
Values of x are
x 1 , x 1.2, x 1 .4,, x 2.8, x 3.
x 1(0.2)3
Values of x are
x 1 , x 1.2, x 1 .4, , x 2.8, x 3.
Example 3.15
Suppose we take five subintervals to solve
dy
our previous problem , i.e. given
x(2 x) y
dx
passing through (1,1) , approximat e y at x 2.
Solution
Here,
and
2 1
h
5
0.2.
x 1(0.2)2.
10
xi
yi
yi
1.0
1.2
1.4
2.36
1.4
1.872
2.712
1.6
2.4144
3.0544
1.8
3.02528
3.38528
2.0
3.702336
xi
yi
yi
1.0
1.1
1.2
2.19
1.2
1.419
2.379
1.3
1.6569
2.5669
1.4
1.91359
2.75359
1.5
2.188949
2.938949
1.6
2.482844
3.122844
1.7
2.795128
3.305128
1.8
3.125641
3.485641
1.9
3.474205
3.664205
10
2.0
3.840626
12
13
h
k1
k 2 hf xi , yi
2
2
h
k2
k3 hf xi , yi
2
2
k 4 hf ( xi h, yi k3 )
where h xi 1 xi
and
1
yi 1 yi (k1 2k 2 2k3 k 4 ).
6
14
Example 3.16
dy
x(2 x) y passing through (1,1).
dx
Approximat e the value of y for x 1(0.5)2.
Given
Solution
In this example we have x0 1, x1 1.5, x2 2.
To estimate y at x1 1.5, we calculate
the following four intermediate values. Using
( x0 , y0 ) (1,1), we have
15
k1 hf ( x0 , y0 )
(0.5) f (1, 1)
(0.5)[1( 2 1) 1] 1
h
k1
k2 hf x0 , y0
2
2
k3 hf x0 , y0 2
2
2
k 4 hf ( x0 h, y0 k3 )
and
k 2 hf x1 , y1 1
2
2
0.5
1.499674
(0.5) f 1.5
,2.249349
2
2
18
h
k2
k3 hf x1 , y1
2
2
0.5
1.718343
(0.5) f 1.5
,2.249349
2
2
k4 hf ( x1 h, y1 k3 )
(0.5) f (1.5 0.5, 2.249349 1.773010)
(0.5) f ( 2, 4.022359)
(0.5) f [2( 2 2) 4.022359]
2.011180 .
19
and
1
y2 y1 (k1 2k 2 2k3 k 4 )
6
3.998276.
xi
yi
k1
k2
1.21875
1.5
2.249349
3.998276
k3
k4
1.273438 1.511719
20
Conclusion
If we increase the number of subintervals
(i.e. with smaller value of h),
then we obtain a more accurate approximation
21