Loading documents preview...
UNIT V NUMERICAL METHODS
Interpolation for equal and unequal integrals: Lagrange’s methods – Newton's forward and backward difference formulae - Divided difference method. ODE: Taylor series – Euler– Runge-Kulta methods
Prepared by Dr. A.R. VIJAYALAKSHMI
Interpolation for equal intervals Newton’s forward interpolation formula is
u(u 1) 2 u(u 1)(u 2) 3 y y0 u y0 y0 y0 .................. 2! 3! where
x x0 u h Newton’s backward interpolation formula is
u(u 1) 2 u(u 1)(u 2) 3 y yn uyn yn yn .................. 2! 3! where
x xn u h
1.Obtain the interpolation quadratic polynomial for the given data by using Newton forward difference formula X : 0 2 4 6 Y : -3 5 21 45 Sol. The difference table is X
0
y f (X)
y
2 y
3 y
-3 8
2
5
8 16
4
21
8 24
6
45
0
Newton Forward Interpolation formula is
u (u 1) 2 u (u 1)(u 2) 3 y y 0 uy 0 y0 y 0 .......... .. 2! 3!
x x0 x0 x u h 2 2
where
( x / 2 )( x / 2 1 ) y 3 ( x / 2 )( 8 ) (8 ) 0 2! y 3 4 x x ( x 2)
y x 2x 3 2
2. Using Newton’s Forward Interpolation formula find the polynomial f(x) Satisfying the following data. Hence find f(2). x : 0 5 10 15 f(x) : 14 379 1444 3584 Sol. The difference table is
X
0
y f (X) y
2 y
3 y
14 365
5
379
700 1065
10
1444
1075 2140
15
3584
375
Newton Forward Interpolation formula is u( u 1) 2 u( u 1)(u 2) 3 y y0 u y 0 y0 y0 .... 2! 3!
where
x x0 x 0 x u h 5 5
x ( x / 5)( x / 5 1) ( x / 5)( x / 5 1)( x / 5 2) y 14 (365) (700) (375) 5 2! 3! 1 14 73 x x ( x 5)(14) x ( x 5)( x 10). 2
1 ( i . e .) f ( x ) x 13 x 56 x 28 2 3
2
1 f ( 2) 2 13( 2) 56 ( 2) 28 100 2 3
2
3.Construct Newton’s forward interpolation polynomial for the following data x: 4 6 8 10 y: 1 3 8 16 Use it to find the value of y for x = 5. Sol. The difference table is
X
y f (X )
4
1
y
3 y
2
y
2 6
3
3 5
8
8
3 8
10
16
0
Newton Forward Interpolation formula is u ( u 1) 2 u ( u 1 )( u 2 ) 3 y y0 u y0 y0 y 0 ... 2! 3! x x0 x 4 u h 2 x 4 1 x 4 x 4 y 1 (2) 1 (3 ) 0 2 2! 2 2
where
3 1 ( x 4) ( x 4)( x 6) 8 8 8 x 32 3( x 10 x 24) 8 2
y (5)
1 3(5) 22(5) 48 13 1.625 8 8 2
1 3 x 22 x 48 8 2
4.Given sin45 0.7071, sin50 0.7660, sin55 0.8192, sin60 0.8660 . Find sin 52 by Newton’ s formula 0
0
0
0
0
Sol.
To find sin 52 , we use Newton’s forward formula. Let y sin x 0
The difference table is
x
y= sinx0
y
2 y
0.0589
-0.0057
3 y
45 0.7071 50 0.7660
-0.0007 0.0532
55 0.8192
-0.0064 0.0468
60 0.8660
0
Newton Forward Interpolation formula is u ( u 1) 2 u ( u 1)( u 2 ) 3 y y 0 u y 0 y0 y 0 .... 2! 3!
where u x x0 52 45 7 1.4 h
5
5
y 0.7071 (1.4)(0.0589)
(1.4)(1.4 1) (0.0057) 2!
(1 . 4 )(1 . 4 1)(1 . 4 2 ) ( 0 . 0007 ) 3! y = 0.7880
(i.e ) sin 52 0.7880 0
5. The following data are taken from the steam table Temp 0 c : 140 150 160 170 180 Pressure kg f/cm2 : 3.685 4.854 6.302 8.076 10.22 Find the pressure at temperature t = 1750 Sol. To find the pressure f(t) at temperature t = 1750 , we use Newton’s Backward formula. The difference table is
t 140
y = f(t)
f (t )
2 f (t )
3 f (t )
4 f (t )
3.685 1.169
150
4.854
0.279 1.448
160
6.302
0.047 0.326
1.774 170
8.076
180
10.225
0.049 0.375
2.149
0.002
Newton Backward Interpolation formula is
u(u 1) 2 u(u 1)(u 2) 3 y yn uyn yn yn .... 2! 3! where u x xn 175 180 0.5 h 10 y 10.225 (0.5)(2.149)
( 0 . 5 )( 0 . 5 1 ) ( 0 . 375 ) 2!
(0.5)(0.5 1)(0.5 2) (0.5)(0.5 1)(0.5 2)(0.5 3) (0.049) (0.002) 3! 4! y = 9.1005
6.From the following data, estimate the number of persons earning weekly Wages between 60 and 70 rupees. Wage Below 40 40 – 60 60 – 80 80 – 100 100 – 120 (in Rs.) No. of person 250 120 100 70 50 (in thousands ) Sol. The difference table is
Wage x Below 40
No. of persons y
y
2 y
3 y
4
y
250 120
Below 60
370
-20 100
Below 80
470
-10 -30
70 Below 100
540
Below 120
590
10 -20
50
20
Let us calculate the number of persons whose weekly wages below 70. So we will use Newton’s forward formula. Newton Forward Interpolation formula is
u(u 1) u(u 1)(u 2) y y u y y y .... 2! 3! 2
0
where
0
3
0
0
x x 0 70 40 u 1 .5 h 20
(1.5)(1.5 1) y 250 (1.5)(120) ( 20) 2! (1.5)(1.5 1)(1.5 2) (1.5)(1.5 1)(1.5 2)(1.5 3) (10) (20) 3! 4!
y 423 .59 424
Number of person whose weekly wages below 70 = 424
Number of person whose weekly wages below 60 = 370
Number of persons whose weekly 424 370 54 thousands . wages between Rs.60 and Rs.70
Interpolation for unequal intervals Lagrange’s interpolation formula y f ( x)
( x x 1 )( x x 2 )( x x 3 ).......( x x n ) y0 ( x 0 x 1 )( x 0 x 2 )( x 0 x 3 ).......( x 0 x n ) ( x x 0 )( x x 2 )( x x 3 ).......( x x n ) y1 ( x 1 x 0 )( x 1 x 2 )( x 1 x 3 ).......( x 1 x n )
( x x 0 )( x x1 )( x x 3 ).......( x x n ) y2 ( x 2 x 0 )( x 2 x1 )( x 2 x 3 ).......( x 2 x n ) +……………………………….+
( x x0 )( x x1 )( x x 2 )( x x3 ).......(x xn1 ) yn ( xn x0 )( xn x1 )( xn x 2 )( x n x3 ).......(x n xn1 )
7.Find the quadratic polynomial that fits y(x) = x4 at x = 0,1,2 Sol.
The following data is
x :
0
1
2
y=x4 :
0
1
16
By Lagrange’s formula
y f ( x)
y f ( x)
( x x1 )( x x2 ) ( x x0 )( x x2 ) ( x x0 )( x x1 ) y0 y1 y2 ( x0 x1 )( x0 x2 ) ( x1 x0 )( x1 x2 ) ( x2 x0 )( x2 x1 )
( x 1)(x 2) ( x 0)(x 2) ( x 0)(x 1) (0) (1) (16) (0 1)(0 2) (1 0)(1 2) (2 0)(2 1)
y x ( x 2) 8 x ( x 1)
y( x) 7 x 6 x 2
8.Using Lagrange’s interpolation formula calculate the profit in the year 2000 from the following data
Year : 1997 Profit in lakhs : 43 of Rs.
1999
2001
2002
65
159
248
Sol. Lagrange’s interpolation formula is
y f ( x)
( x x1 )( x x2 )( x x3 ) ( x x0 )( x x2 )( x x3 ) y0 y1 ( x0 x1 )( x0 x2 )( x0 x3 ) ( x1 x0 )( x1 x2 )( x1 x3 )
( x x0 )( x x1 )( x x3 ) ( x x0 )( x x1 )( x x2 ) y2 y3 ( x2 x0 )( x2 x1 )( x 2 x3 ) ( x3 x0 )( x3 x1 )( x3 x2 )
Here x = 2000
(2000 1999)(2000 2001)(2000 2002) y f ( x) 43 (1997 1999)(1997 2001)(1997 2002)
( 2000 1997 )( 2000 2001 )( 2000 2002 ) 65 ( 2000 1997 )( 2000 2001 )( 2000 2002 ) (2000 1997)(2000 1999)(2000 2002) 159 (2001 1997)(2001 1999)(2001 2002)
y f ( x)
( 2000 ( 2002
1997 )( 2000 1997 )( 2002
1999 )( 2000 1999 )( 2002
(1)(1)(2) (3)(1)(2) 43 65 (2)(4)(5) (2)(2)(3)
( 3 )( 1)( 2 ) ( 3 )( 1)( 1) 159 248 ( 4 )( 2 )( 1) ( 5 )( 3 )( 1 )
y = – 2.15 + 32.5 + 119.25 – 49.6 , y = 100.
2001 ) 248 2001 )
9. Using Lagrange’s interpolation formula fit a polynomial to following data x : –1 0 2 3 y : –8 3 1 12 and hence find y at x = 1.5 Sol. Lagrange’s interpolation formula is
y f ( x)
( x x1 )(x x2 )(x x3 ) ( x x0 )(x x2 )(x x3 ) y0 y1 ( x0 x1)(x0 x2 )(x0 x3 ) ( x1 x0 )(x1 x2 )(x1 x3 )
( x x0 )(x x1 )(x x3 ) ( x x0 )(x x1 )(x x2 ) y2 y3 ( x2 x0 )(x2 x1 )(x2 x3 ) ( x3 x0 )(x3 x1 )(x3 x2 )
y f ( x)
( x 0)( x 2)( x 3) ( x 1)( x 2)( x 3) (8) (3) (1 0)(1 2)(1 3) (0 1)(0 2)(0 3)
( x 1)( x 0)( x 3) ( x 1)( x 0)( x 2) (1) (12) (2 1)(2 0)(2 3) (3 1)(3 0)(3 2)
2 1 1 2 2 y x( x 5x 6) ( x 1)(x 5x 6) x( x2 2x 3) x( x2 x 2) 3 2 6
1 y [(4 x 20 x 24 x ) (3 x 12 x 3 x 18) 6 3
2
3
2
( x 2x 3x) (6x 6x 12x)] 3
2
3
2
1 y (12 x 36 x 18 x 18 ) , 6 3
2
y 2 x 6 x 3x 3 3
2
y(1.5) = 2(1.5)3 – 6(1.5)2 + 3(1.5) + 3 = 0.75
10.Find the polynomial f(x) by using Lagrange’s formula and hence find f(3) for x: 0 1 2 5 f(x) : 2 3 12 147 Sol. Lagrange’s interpolation formula is
y f ( x)
( x x1 )( x x2 )( x x3 ) ( x x0 )( x x2 )( x x3 ) y0 y1 ( x0 x1 )( x0 x2 )( x0 x3 ) ( x1 x0 )( x1 x2 )( x1 x3 )
( x x0 )( x x1 )( x x3 ) ( x x0 )( x x1 )( x x2 ) y2 y3 ( x2 x0 )( x2 x1 )( x2 x3 ) ( x3 x0 )( x3 x1 )( x3 x2 )
( x 1)( x 2)( x 5) ( x 0)( x 2)( x 5) y f ( x) ( 2) (3) (0 1)(0 2)(0 5) (1 0)(1 2)(1 5)
( x 0 )( x 1)( x 5 ) ( x 0 )( x 1)( x 2 ) (12 ) (147 ) ( 2 0 )( 2 1)( 2 5 ) ( 5 0 )( 5 1)( 5 2 )
y
1 3 49 (x 1)(x2 7x 10) x(x 2 7x 10) 2x(x 2 6x 5) x( x 2 3x 2) 5 4 20
11.Given log 654 2 . 8156 , log 10
log10 661 2.8202 . Find The following data is x :
Sol.
log 10 656 654
658
log10 x : 2.8156
2.8182
Let y log x 10
10
658 2 . 8182 , log10 659 2.8189
by using Lagrange’s formula 659
661
2.8189
2.8202
Here x = 656
Lagrange’s interpolation formula is
( x x1)(x x2 )(x x3 ) ( x x0 )(x x2 )(x x3 ) y f ( x) y0 y1 ( x0 x1)(x0 x2 )(x0 x3 ) ( x1 x0 )(x1 x2 )(x1 x3 )
( x x0 )( x x1 )( x x3 ) ( x x0 )( x x1 )( x x2 ) y2 y3 ( x2 x0 )( x2 x1 )( x2 x3 ) ( x3 x0 )( x3 x1 )( x3 x2 )
( 656 ( 654
y .
658 , )( 656 658 )( 654
659 )( 656 , 659 )( 654
661 ) 2, . 8156 661 )
( 656 654 )( 656 659 )( 656 661 ) 2 . 8182 ( 658 654 )( 658 659 )( 658 661 )
( 656 654 )( 656 658 )( 656 661 ) 2 . 8189 ( 659 654 )( 659 658 )( 659 661 ) ( 656 654 )( 656 658 )( 656 659 ) 2 . 8202 ( 661 654 )( 661 658 )( 661 659 )
y
( 2 )( 3)( 5 ) ( 2 )( 3)( 5 ) 2 .8156 2 . 8182 ( 4 )( 5 )( 7 ) ( 4 )( 1)( 3) ( 2)( 2)( 5) ( 2)( 2)( 3) 2.8189 2.8202 (5)(1)( 2) (7 )(3)( 2)
y = 0.6033 + 7.0455 – 5.6378 + 0.8058 , y = 2.8168 (i.e.)
log
10
656
2.8168
Lagrange’s formula for inverse interpolation.
( y y1 )( y y 2 )( y y 3 ).......( y y n ) x f ( y) x0 ( y 0 y1 )( y 0 y 2 )( y 0 y 3 ).......( y 0 y n ) ( y y )( y y )( y y ).......( y y ) x .... ( y y )( y y )( y y ).......( y y ) 0
2
3
n
1
1
0
1
2
1
3
1
n
Newton divided difference formula 3 ( x x )( x x )( x x ) y0 y y0 ( x x0 )y0 ( x x0 )( x x1 ) y0 0 1 2 2
+………..
Divided differences are symmetrical in their arguments. f ( x1 ) f ( x0 ) f ( x0 ) f ( x1 ) f ( x0 , x1 ) f ( x1 , x0 ). x1 x0 x0 x1
1.Find the second divided differences with arguments a,b,c if f(x) = 1/x. Sol. The divided difference table is y = 1/x x a
1/a
b
1/b
c
1/c
y
2 y
–1/ab –1/bc
1/abc
2.If f(x) = 1/x2, find f(a,b) and f(a,b,c) by using divided differences. Sol. The divided difference table is
x
y = 1/x2
a
1/a2
y
2 y
– (a+b)/a2b2 b
1/b2 (ab + bc + ca) / a2b2c2 – (b+c)/b2c2
c
1/c2
12.Using Newton divided difference formula find u(3) given u(1) = –26, u(2) = 12, u(4) = 256, u(6) = 844. Sol. The divided difference table is
x
y = u(x)
1
–26
y
3 y
2 y
38 2
12
28 122
4
256
43 294
6
844
3
Newton divided difference formula is
y y0 ( x x0 )y0 ( x x0 )( x x1 )2 y0 (x x0)(x x1)(x x2)3 y0 . Here x = 3
y = –26 + (3 –1).(38) + (3 –1)(3 – 2)(28) + (3 –1)(3 – 2)(3 – 4)(3) = 132 – 32 = 100 (i.e.) u(3) = 100.
13.Given u 4 , u 2 , u 220 , u 546 , u 1148 0
Find u & u 2
1
4
5
6
3
Sol. The divided difference table is x 0
y u
y
2 y
3 y
x
4 y
–4 2
1
–2
18 74 9
4
220
63
1
326 15 5
546
138 602
6
1148
Newton divided difference formula is
y y0 ( x x0 )y0 ( x x0 )( x x1 )2 y0 (x x0 )(x x1 )(x x2 )3 y0 (x x0 )(x x1 )(x x2 )(x x3 )4 y0 ................ y 4 ( x 0 )( 2 ) ( x 0 )( x 1)(18 ) ( x 0)( x 1)( x 4)(9) ( x 0)( x 1)( x 4)( x 5)(1) u 4 ( 2 )( 2 ) ( 2 )( 1 )( 18 ) ( 2 )( 1 )( 2 )( 9 ) ( 2 )( 1 )( 2 )( 3 )( 1 ) 2
= – 4 + 4 + 36 – 36 + 12= 12. = – 4 +(3)(2) + (3)(2)(18) + (3)(2)( –1)(9) + (3)(2)( –1)( –2)(1) = – 4 + 6 + 108 – 54 + 12= 68.
u – 4 (3)(2) (3)(2)(18) (3)(2)( – 1)(9) (3)(2)( – 1)( – 2)(1) 3
– 4 6 108 – 54 12 68.
14.From the following table, find the value of tan 45 015’ by Newton’s Forward Interpolation formula. x o : 45 46 47 48 49 50 tan x o : 1 1.03553 1.07237 1.11061 1.15037 1.19175 Sol.
y xo
y = tan xo
45
1
2 y
3 y
4 y
5 y
0.03553 46
1.03553
0.00131 0.03684
47
1.07237
0.00009 0.00140
0.03824 48
1.11061
0.00012 0.00152
0.03976 49
1.15037 1.19175
-0.00005 -0.00002
0.00010 0.00162
0.04138 50
0.00003
Newton Forward Interpolation formula is
y y 0 uy 0
where
u ( u 1) 2 u ( u 1)( u 2 ) 3 y0 y 0 .......... .. 2! 3!
x x0 4515 45 u 0.25 h 1
( 0 . 25 )( 0 . 25 1) y 1 ( 0 . 25 )( 0 .03553 ) ( 0 . 00131 ) 2! ( 0 .25 )( 0 .25 1)( 0 .25 2 ) ( 0.00009 ) 3!
(0.25)(0.25 1)(0.25 2)(0.25 3) (0.00003) 4! (0.25)(0.25 1)(0.25 2)(0.25 3)(0.25 4) (0.00005) 5!
y 1 0.00888 0.00012 0.0000049 ............... (i.e.) tan 45 015’ = 1.00876
Numerical Solution of Ordinary Differential Equations Taylor series
( x x0 ) 2 ( x x0 ) 3 y ( x ) y 0 ( x x 0 ) y 0 y 0 y 0 2! 3! ( x x0 ) 4 iv y ....... 4!
dy 1 • Using Taylor’ s series find y at x 0.1 if x y 1, dx y(0) 1. 2
Sol. Given
y x 2 y 1, x 0 0 , y 0 1
y x 2 y 1, y x 2 y y . 2 x y x 2 y y.2x 2x. y 2 y.1
2 y0 x0 y0 1 0 1 1
2
y 0 x 0 y 0 2 x 0 y 0 0 0 0 2 y0 x0 y0 4x0 y0 2 y0 0 0 2 2
yiv x2 y y.2x 4x.y 4y.1 2y y0 iv x0 2 y0 2x0 y0 4x0 y0 6 y0 y0
iv
0 0 0 ( 6) 6
Taylor’ s series about x x is given by 0
(x x ) (x x ) (x x ) y( x) y ( x x ) y y y y ....... 2! 3! 4! 2
3
0
0
0
0
4
0
0
iv
0
0
0
( x 0) ( x 0) ( x 0) y ( x ) 1 ( x 0 )( 1 ) (0) (2) ( 6 ) ....... 2! 3! 4! 2
3
4
x3 x4 1 x .......... ... 3 4
x3 x4 y( x) 1 x 0 (2) ( 6 ) .......... ... 6 24 ( 0 .1) 3 ( 0 .1) 4 y ( 0 .1) 1 ( 0 .1) .......... ... 3 4
dy 2.Use Taylor series solution to solve numericall y xy dx , y(1) 1. Tabulate y for x 1.1, 1.2 Sol. Given
1 3
x 0 1, y 0 1
1 3
1 3
y xy y 0 x 0 y 0 1(1) 1 2 3
1 3
1 1 4 1 1 2 1 y x y . y y y0 x0 y0 3 . y0 y0 3 3 3 3 3
1 2 / 3 1 2 / 3 1 2 / 3 2 5 / 3 y xy y y xy y y y .1 y y 3 3 3 9 y 0
2 4 1 1 8 9 9 3 3 9
Taylor’ s series about x x is given by 0
(x x ) (x x ) (x x ) y( x) y ( x x ) y y y y ....... 2! 3! 4! 2
3
0
0
0
0
0
0
3 4 ( x 1 ) 3! 3
(1 .1 1) 2 y (1 .1) 1 (1 .1 1)(1) 2!
iv
0
0
( x 1) 2 y ( x ) 1 ( x 1)(1) 2!
4
0
8 ..... 9
3 4 (1 .1 1) 3! 3
8 ..... 9
2 ( 0 .1 ) 4 ( 0 .1 ) 1 0.1 ........ 3 27 2
3
= 1 + 0.1 + 0.0067 + 0.00014 = 1.1068
(1 .2 1) 2 4 (1 . 2 1) 3 y (1 . 2 ) 1 (1 .2 1)(1) 2! 3! 3
2 ( 0 .2 ) 2 4 ( 0 .2 ) 3 1 0.2 ........ 3 27
8 ..... 9
= 1 + 0.2 + 0.0267 + 0.0012 = 1.2279
d y dy 3.Find the value of y(1.1) and y(1.2) from y x , dx dx y ( 1 ) 1 , y ( 1 ) 1 by using Taylor’ s series method. 2
2
2
Sol. Given
y y y x (1) 2
3
Put y z (2) , then y z (3)
Sub (2) and (3) in (1), we get
z y2 z x3 (ie ).z x y z (4) 3
2
The initial conditions are y(1) 1, y (1) 1
( i .e ) y ( 1 ) 1 , z ( 1 ) 1 (sin ce y z ) ( i .e ) x 1 , y 1 , z 1 0
0
0
Now to solve (1), it is enough if we solve the two first order differential equations (2) and (4).
3
y z y 0 z 0 1 y z y 0 z 0 0
y z y0 z 0 1
y iv z iv y 0 z 0 3
z x3 y 2 z 3
2
z 0 x 0 y 0 z 0 1 1 0 z 3 x 2 y 2 z z .2 y . y z 0 3 (1 ) 0 2 (1 )( 1 )( 1 ) 1
z 6x y 2 z z.2 y. y 2[ y z. y y y.z yz.y] z0 6(1) (1)(1) 0 2[0 0 1] 6 1 2 3
Taylor’ s series about x x is given by 0
(x x ) (x x ) (x x ) y( x) y ( x x ) y y y y ....... 2! 3! 4! 2
3
0
0
0
0
4
0
0
iv
0
0
0
( x 1) ( x 1) ( x 1) y ( x ) 1 ( x 1 )( 1 ) (0) (1 ) ( 3 ) .......... . 2! 3! 4! 2
3
4
(1.1 1) 3 (1.1 1) 4 y(1.1) 1 (1.1 1)(1) (3) ..... 6 24 (0.1)3 (0.1)4 1 0.1 ........ 6 8 = 1 + 0.1 + 0.00017 + 0.0000125 = 1.1002
(1.2 1) 3 (1.2 1) 4 y (1.2) 1 (1.2 1)(1) (3) ..... 6 24
(0.2)3 (0.2)4 1 0.2 ........ 6 8 = 1 + 0.2 + 0.0013+ 0.0002 = 1.2015
Euler’s method To solve
use
y'
dy f ( x , y ) with y ( x 0 ) y 0 dx
yn1 yn h f ( xn , yn ) , n 0,1,2,... It’s order is
h2
dy y x 1.Use Euler’ s method to approximate y when x 0.1 given that dx y x with y 1 for x 0. Sol.
We break up the interval 0.1 into five subintervals, we get the answer in more accurate form. So take h = 0.02
yx Given f ( x , y ) , x 0 0, y0 1 and h 0.02 yx x1 x 0 h = 0 + 0.02 = 0.02
y1 y0 hf ( x0 , y0 ) y 0 x0 y1 y 0 h y x 0 0 1 0 = 1.02 1 (0.02) 1 0
y 2 y1 hf ( x1 , y1 ) y x1 y 2 y1 h 1 y x 1 1
1 . 02 0 . 02 1.02 (0.02) 1 . 02 0 . 02 = 1.0392
(i.e.) y(0.02) = 1.02
(i.e.) y(0.04) = 1.0392
x2 x1 h = 0.02 + 0.02
= 0.04
y3 y2 hf(x2 , y2 ) y 2 x2 y3 y 2 h y x 2 2 1.0392 0.04 = 1.0392+ (0.02) 1.0392 0.04
(i.e.) y(0.06) = 1.0577
= 1.0577
x3 x2 h
= 0.04+ 0.02= 0.06
y 4 y3 hf ( x3 , y3 ) y3 x3 1.0577 0.06 y4 y3 h =1.0577+ (0.02)1.0577 0.06 y3 x3
= 1.0756
(i.e.) y(0.08) = 1.0756
x 4 x3 h
= 0.06 + 0.02= 0.08
y5 y4 hf (x4 , y4 ) y4 x4 y5 y 4 h y x 4 4 1 .0756 0 .08 = 1.0756 + (0.02) 1 .0756 0 .08
= 1.0928
(i.e.) y(0.1) = 1.0928
•Solve
dy 1 y dx
with the initial condition x = 0, y = 0.Using modified Euler’s
.Method tabulate the solutions at x = 0.1, 0.2, 0.3, 0.4. Sol.
Given
Also given
f ( x, y) 1 y
x0 0, y0 0
and h = 0.1
h y1 y0 f ( x0 , y0 ) f [ x0 h, y0 hf ( x0 , y0 )] 2
f ( x0 , y0 ) 1 y0 =1–0=1
y1 0
0 .1 1 f [0 0.1,0 ( 0.1)(1)] 2
0 0
0 .1 1 f [ 0 . 1, 0 . 1 ] 2
0.1 1 (1 0.1) = 0.095 2
.
(i.e.) y(0.1) = 0.095
x1 x0 h
= 0 + 0.1= 0.1
h y 2 y 1 f ( x 1 , y 1 ) f [ x 1 h , y 1 hf ( x 1 , y 1 )] 2 f (x , y ) 1 y 1
1
1
= 1 – 0.095 = 0.905
0 .1 y 2 0 . 095 0 .905 f [ 0 .1 0 .1,0 .095 ( 0 .1)( 0 .905 )] 2 y2
0 .1 0 . 095 0 . 905 f [ 0 . 2 , 0 . 1855 ] 2
0 . 095
0 .1 0 .905 (1 0 .1855 ) 2
0.095
0.1 0.905 0.8145 2
= 0.18098
(i.e.) y(0.2) = 0.18098
x 2 x1 h y3 y2
= 0.1+ 0.1= 0.2
h f ( x 2 , y 2 ) f [ x 2 h , y 2 hf ( x 2 , y 2 )] 2
f ( x2 , y 2 ) 1 y 2 = 1 – 0.18098= 0.81902 y 3 0 . 18098 y 3 0.18098
0.18098
0 .1 0 .81902 f [ 0 .2 0 .1,0 .18098 ( 0 .1)( 0 .81902 )] 2 0. 1 0.81902 f [0.3,0.2629] 2
0 .1 0.81902 (1 0.2629) 2
0 . 18098
0 .1 0 . 81902 0 .7371 2
= 0.2588 (i.e.) y(0.3) = 0.2588
x3 x 2 h
= 0.2+ 0.1= 0.3
y4 y3
h f ( x3 , y3 ) f [ x3 h, y3 hf ( x3 , y3 )] 2
f ( x3 , y 3 ) 1 y3 y 4 0 . 2588 y 4 0 .2588
= 1 – 0.2588 = 0.7412
0 .1 0 .7412 f [ 0 .3 0 . 1,0 .2588 ( 0 .1)( 0 .2588 )] 2
0.1 0.7412 f [ 0.4,0 .3329 ] y 4 0.2588 0.1 0.7412 (1 0.3329) 2 2
y 4 0.2588
0 .1 0.7412 0.6671 2
= 0.3292 (i.e.) y(0.4) = 0.3292
•Using R-K method of fourth order, solve
y 3 x
1 y 2
with y(0) = 1 at x = 0.2 taking h = 0.1
Sol. Given
1 f ( x, y) 3x y 2
Also given
x0 0, y0 1
Take h = 0.1 To find y(0.1)
k1 hf ( x0 , y0 ) y0 (0.1)3x0 2 1 (0.1) 3 ( 0 ) 0 . 05 . 2
h k1 k2 hf x0 , y0 2 2 0.05 0.1 (0.1) f 0 , 1 2 2 1 . 025 (0.1) f ( 0 . 05 , 1 . 025 ) 0.1 3 ( 0 . 05 ) 2 = 0.0663
k h k 3 hf x 0 , y 0 2 2 2
0.0663 0.1 (0.1)f 0 , 1 2 2
(0.1) f (0.05,1.0332) 1.0332 0.13(0.05) 2 = 0.0667
= 0.0666
1 [0.05 2(0.0663) 2(0.0667) 0.0833] 6
y1 y0 y (i.e.) y(0.1) = 1.0666
k 4 hf x 0 h , y 0 k 3 (0.1) f (0 0.1,1 0.0667) 1.0667 (0.1) 3(0.1) 2
1 y [k1 2k2 2k3 k4 ] 6
= 0.0833