0% found this document useful (0 votes)
130 views17 pages

Euler

1) The document provides examples of using numerical methods like Euler's method and the Euler-Cauchy method to solve first-order differential equations. 2) Specific examples include using Euler's method to solve dy/dx = 3 - y/x, 1/x dy/dx + 2y = 1, and dy/dx + y/x = -1 with different initial conditions. 3) The document also calculates percentage errors when comparing numerical solutions to known analytical solutions.

Uploaded by

Lei Lopez
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)
130 views17 pages

Euler

1) The document provides examples of using numerical methods like Euler's method and the Euler-Cauchy method to solve first-order differential equations. 2) Specific examples include using Euler's method to solve dy/dx = 3 - y/x, 1/x dy/dx + 2y = 1, and dy/dx + y/x = -1 with different initial conditions. 3) The document also calculates percentage errors when comparing numerical solutions to known analytical solutions.

Uploaded by

Lei Lopez
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/ 17

CHAPTER 80 NUMERICAL METHODS FOR FIRST-ORDER

DIFFERENTIAL EQUATIONS

EXERCISE 303 Page 834

dy y
1. Use Euler’s method to obtain a numerical solution of the differential equation = 3 – , with
dx x

the initial conditions that x = 1 when y = 2, for the range x = 1.0 to x = 1.5 with intervals of 0.1.

Draw the graph of the solution in this range.

dy y
= y '= 3 −
dx x
2
If initially x 0 = 1 and y0 = 2, (and h = 0.1), then (y') 0 = 3 − =1
1
Line 1 in the table below is completed with x = 1.0 and y = 2

For line 2, where x 0 = 1.1 and h = 0.1:

y1 = y0 + h(y') 0 = 2.0 + (0.1)(1) = 2.1

y0 2.1
and (y') 0 = 3 – =3– = 1.0909
x0 1.1

For line 3, where x 0 = 1.2: y 1 = y0 + h(y') 0 = 2.1 + (0.1)(1.0909) = 2.209091

y0 2.209091
and (y') 0 = 3 – =3– = 1.159091
x0 1.2

For line 4, where x 0 = 1.3: y 1 = y0 + h(y') 0 = 2.209091 + (0.1)(1.15909) = 2.325000

The remaining lines of the table are completed in a similar way.

1230 © 2014, John Bird


dy y
A graph of the solution of = 3 − , with initial conditions x = 1 and y = 2 is shown below
dx x

1 dy
2. Obtain a numerical solution of the differential equation + 2y = 1, given the initial
x dx

conditions that x = 0 when y = 1, in the range x = 0(0.2)1.0

1 dy dy
Since + 2y = 1 then = x(1 – 2y) or y´ = x(1 – 2y)
x dx dx

If initially x 0 = 0 and y0 = 1, (and h = 0.2), then (y') 0 = 0(1 – 2) = 0

Line 1 in the table below is completed with x = 0, y = 1 and (y')0 = 0

x y (y') 0
0 1 0
0.2 1 –0.2
0.4 0.96 –0.368
0.6 0.8864 –0.46368
0.8 0.793664 –0.469824
1.0 0.699692

For line 2, where x 0 = 0.2 and h = 0.2:

y1 = y0 + h(y') 0 = 1.0 + (0.2)(0) = 1

and (y') 0 = x 0 (1 – 2y 0 ) = 0.2(1 – 2) = –0.2

For line 3, where x 0 = 0.4: y 1 = y0 + h(y') 0 = 1.0 + (0.2)(– 0.2) = 0.96

and (y') 0 = x 0 (1 – 2y 0 ) = 0.4(1 – 2(0.96)) = –0.368

1231 © 2014, John Bird


For line 4, where x 0 = 0.6: y 1 = y0 + h(y') 0 = 0.96 + (0.2)(– 0.368) = 0.8864

and (y') 0 = x 0 (1 – 2y0 ) = 0.6(1 – 2(0.8864)) = –0.46368

For line 5, where x 0 = 0.8: y 1 = y0 + h(y') 0 = 0.8864 + (0.2)(–0.46368) = 0.793664

and (y') 0 = x 0 (1 – 2y0 ) = 0.8(1 – 2(0.793664)) = –0.4698624

For line 6, where x 0 = 1.0: y 1 = y0 + h(y') 0 = 0.793664 + (0.2)(– 0.4698624) = 0.699692

1 dy
Hence a numerical solution to the differential equation + 2y = 1 is given by the first two
x dx
columns in the above table.

dy y
3. (a) The differential equation + 1 = – has the initial conditions that y = 1 at x = 2. Produce a
dx x

numerical solution of the differential equation in the range x = 2.0(0.1)2.5

4 x
(b) If the solution of the differential equation by an analytical method is given by y = – ,
x 2

determine the percentage error at x = 2.2

dy y dy y
(a) + 1 =− i.e. =y ' =−1 −
dx x dx x
1
If initially x 0 = 2.0 and y 0 = 1 (and h = 0.1), then (y') 0 = −1 − = –1.5
2.0
Line 1 in the table below is completed with x = 2.0 and y = 1

For line 2, where x0 = 2.1 and h = 0.1:

y1 = y0 + h(y') 0 = 1 + (0.1)(–1.5) = 0.85

y0 0.85
and (y') 0 = –1 – = –1 – = –1.40476
x0 2.1

For line 3, where x0 = 2.2: y 1 = y 0 + h(y') 0 = 0.85 + (0.1)(–1.40476) = 0.709524


1232 © 2014, John Bird
y0 0.709524
and (y') 0 = –1 – = –1 – = –1.322511
x0 2.2

For line 4, where x0 = 2.3: y 1 = y 0 + h(y')0 = 0.709524 + (0.1)(–1.322511) = 0.577273

The remaining lines of the table are completed in a similar way

4 x
(b) If y = − then when x = 2.2, y = 0.718182
x 2
From the Euler method, when x = 2.2, y = 0.709524

0.718182 − 0.709524 0.008658


Hence, percentage error = ×100%
= ×100%
0.718182 0.718182

= 1.206%

dy 2y
4. Use Euler’s method to obtain a numerical solution of the differential equation =x– ,
dx x

given the initial conditions that y = 1 when x = 2, in the range x = 2.0(0.2)3.0

x2
If the solution of the differential equation is given by y = , determine the percentage error by
4

using Euler’s method when x = 2.8

dy 2y
(a) = y '= x −
dx x
2(1)
If initially x 0 = 2.0 and y 0 = 1, (and h = 0.2), then (y') 0 = 2.0 − = 1.0
2.0
Line 1 in the table below is completed with x = 2.0 and y = 1

For line 2, where x0 = 2.2 and h = 0.2:

y1 = y0 + h(y') 0 = 1 + (0.2)(1.0) = 1.2

2(1.2)
and (y') 0 = 2.2 – = 1.109091
2.2

For line 3, where x0 = 2.4: y 1 = y 0 + h(y') 0 = 1.2 + (0.2)(1.109091) = 1.4218182


1233 © 2014, John Bird
2(1.4218182)
and (y') 0 = 2.4 – = 1.2151515
2.4

For line 4, where x0 = 2.6: y 1 = y 0 + h(y') 0 = 1.4218182 + (0.2)(1.2151515) = 1.664849

The remaining lines of the table are completed in a similar way

x2
(b) If y = , then when x = 2.8, y = 1.96
4
From the Euler method, when x = 2.8, y = 1.928718

1.96 − 1.928718 0.031282


Hence, percentage error = ×100%
= ×100%
1.96 1.96

= 1.596%

1234 © 2014, John Bird


EXERCISE 304 Page 838

dy y
1. Apply the Euler–Cauchy method to solve the differential equation =3– for the range
dx x

1.0(0.1)1.5, given the initial conditions that x = 1 when y = 2

dy y
= y '= 3 −
dx x

x 0 = 1, y 0 = 2 and h = 0.1

y0 2
(y ′) 0 = 3 − =3 − =1
x0 1

x 1 = 1.1 and from equation (3), page 836, y P1 = y 0 + h(y′) 0 = 2 + 0.1(1) = 2.1

1 1 yP
y C1 = y 0 + h [ (y′) 0 + f(x 1 , y P1 ) ] = y0 + h [ (y′) 0 + 3 − 1 ]
2 2 x1

1 2.1
=2+ (0.1) [ 1 + 3 − ]
2 1.1

= 2.10454546

yC1 2.10454546
(y′) 1 =−
3 =−
3 = 1.08677686
x1 1.1

Thus the first two lines of the table below have been completed

x y y′
1.0 2 1
1.1 2.10454546 1.08677686
1.2 2.216666672 1.152777773
1.3 2.33461539 1.204142008
1.4 2.457142859 1.244897958
1.5 2.5883333335

For line 3, x 1 = 1.2

y P1 = y 0 + h(y′) 0 = 2.10454546 + 0.1(1.08677686) = 2.213223146

1 yP
y C1 = y 0 + h [ (y′) 0 + 3 − 1 ]
2 x1

1235 © 2014, John Bird


1 2.213223146
= 2.10454546 + (0.1) [ 1.08677686 + 3 − ] = 2.216666672
2 1.2

yC1 2.216666672
(y ′) 1 =−
3 =−
3 = 1.152777773
x1 1.2

The remaining lines of the table are completed in a similar way

2. Solving the differential equation in Problem 1 by the integrating factor method gives

3 1
y= x+ . Determine the percentage error, correct to 3 significant figures, when x = 1.3 using
2 2x

(a) Euler’s method, and (b) the Euler–Cauchy method.

3 1
If y = x+ then when x = 1.3, y = 2.334615385
2 2x

(a) By Euler’s method, when x = 1.3, y = 2.325000

2.334615385 − 2.3250
Percentage error = ×100% = 0.412%
2.334615385

(b) By the Euler–Cauchy method, when x = 1.3, y = 2.33461539

2.334615385 − 2.33461539
Percentage error = ×100% = 0.000000214%
2.334615385

dy
3. (a) Apply the Euler–Cauchy method to solve the differential equation – x = y for the range
dx

x = 0 to x = 0.5 in increments of 0.1, given the initial conditions that when x = 0, y = 1

(b) The solution of the differential equation in part (a) is given by y = 2e x – x – 1. Determine the

percentage error, correct to 3 decimal places, when x = 0.4

dy
(a) = y' = y + x
dx

x 0 = 0, y 0 = 1 and h = 0.1

(y′) 0 = 1 + 0 = 1

x 1 = 0.1 and from equation (3), page 836, y P1 = y 0 + h(y ′) 0 = 1 + 0.1(1) = 1.1
1236 © 2014, John Bird
1 1
y C1 = y 0 + h [ (y ′) 0 + f(x 1 , y P1 ) ] = y0+ h [ (y′) 0 + y P1 + x 1 ]
2 2

1
=1+ (0.1) [ 1 + 1.1 + 0.1 ]
2

= 1.11

(y′) 1 = y C 1 + 0.1 = 1.11 + 0.1 = 1.21

Thus the first two lines of the table below have been completed

For line 3, x 1 = 0.2

y P1 = y 0 + h(y ′) 0 = 1.11 + 0.1(1.21) = 1.231

1
y C1 = y 0 + h [ (y′) 0 + y P1 + x 1 ]
2

1
= 1.11 + (0.1) [ 1.21 + 1.231 + 0.2 ] = 1.24205
2

(y′) 1 = y C 1 + 0.2 = 1.24205+ 0.2 = 1.44205

The remaining lines of the table are completed in a similar way

(b) If y = 2 e x − x − 1 then when x = 0.4, y = 1.583649395

By the Euler–Cauchy method, when x = 0.4, y = 1.581804

1.583649395 − 1.581804
Hence, the percentage error = ×100% = 0.117%
1.583649395

1237 © 2014, John Bird


1 dy
4. Obtain a numerical solution of the differential equation + 2y = 1 using the Euler–Cauchy
x dx

method in the range x = 0(0.2)1.0, given the initial conditions that x = 0 when y = 1

1 dy dy
Since + 2y = 1 then = x(1 – 2y) or y′ = x(1 – 2y)
x dx dx

If initially x 0 = 0 and y0 = 1 (and h = 0.2), then (y') 0 = 0(1 – 2) = 0

Line 1 in the table below is completed with x = 0, y = 1 and (y')0 = 0

x y (y') 0
0 1 0
0.2 0.98 – 0.192
0.4 0.925472 – 0.3403776
0.6 0.84854666 – 0.41825599
0.8 0.76433779 – 0.42294046
1.0 0.68609380

For line 2, x 1 = 0.2, and from equation (3), page 836, y P1 = y 0 + h(y′) 0 = 1 + 0.2(0) = 1

1 1
y C1 = y 0 + h [ (y′) 0 + f(x 1 , y P1 ) ] = y0+ h [ (y′) 0 + x 1 (1 – 2y P1 ) ]
2 2

1
=1+ (0.2) [ 0 + 0.2(1 – 2(1)) ]
2

= 0.98

(y′) 1 = x 1 (1 – 2y C1 ) = 0.2(1 – 2(0.98)) = –0.192

Hence, line 2 is completed in the above table.

For line 3, x 1 = 0.4, and from equation (3), page 836, y P1 = y 0 + h(y′) 0 = 0.98 + 0.2(– 0.192)

= 0.9416

1 1
y C1 = y 0 + h [ (y′) 0 + f(x 1 , y P1 ) ] = y0+ h [ (y ′) 0 + x 1 (1 – 2y P1 ) ]
2 2

1
= 0.98 + (0.2) [ – 0.192 + 0.4(1 – 2(0.9416)) ]
2

= 0.925472

1238 © 2014, John Bird


(y′) 1 = x 1 (1 – 2y C1 ) = 0.4(1 – 2(0.925472)) = –0.3403776

Hence, line 3 is completed in the above table

For line 4, x 1 = 0.6, and from equation (3), page 836, y P1 = y 0 + h(y′) 0

= 0.925472 + 0.2(–0.3403776)

= 0.85739648

1 1
y C1 = y 0 + h [ (y′) 0 + f(x 1 , y P1 ) ] = y0+ h [ (y′) 0 + x 1 (1 – 2y P1 ) ]
2 2

1
= 0.925472 + (0.2) [ – 0.3403776 + 0.6(1 – 2(0.85739648)) ]
2

= 0.84854666

(y′) 1 = x 1 (1 – 2y C1 ) = 0.6(1 – 2(0.84854666)) = –0.41825599

Hence, line 4 is completed in the above table

For line 5, x 1 = 0.8, and from equation (3), page 836, y P1 = y 0 + h(y′) 0

= 0.84854666 + 0.2(–0.41825599)

= 0.764895461

1 1
y C1 = y 0 + h [ (y′) 0 + f(x 1 , y P1 ) ] = y0 + h [ (y′) 0 + x 1 (1 – 2y P1 ) ]
2 2

1
= 0.84854666 + (0.2) [ –0.41825599 + 0.8(1 – 2(0.764895461)) ]
2

= 0.76433779

(y′) 1 = x 1 (1 – 2y C1 ) = 0.8(1 – 2(0.76433779)) = –0.42294046

Hence, line 5 is completed in the above table

For line 6, x 1 = 1.0, and from equation (3), page 836, y P1 = y 0 + h(y′) 0

= 0.76433779 + 0.2(–0.42294046)

= 0.679749698

1 1
y C1 = y 0 + h [ (y′) 0 + f(x 1 , y P1 ) ] = y0+ h [ (y′) 0 + x 1 (1 – 2y P1 ) ]
2 2

1239 © 2014, John Bird


1
= 0.76433779 + (0.2) [ – 0.42294046 + 1.0(1 – 2(0.679749698)) ]
2

= 0.68609380

Hence, line 6 is completed in the above table.

1240 © 2014, John Bird


EXERCISE 305 Page 843

dy y
1. Apply the Runge–Kutta method to solve the differential equation: = 3 − for the range
dx x

1.0(0.1)1.5, given the initial conditions that x = 1 when y = 2

dy y
= 3−
dx x

1. x0 = 1, y0 = 2 and since h = 0.1, and the range is from x = 1 to x = 1.5, then

= =
x1 1.1, =
x2 1.2, =
x3 1.3, =
x4 1.4 and x5 1.5

Let n = 0 to determine y1 :

dy y 2
2. k1 = f ( x0 , y0 ) = f (1, 2); since = 3 − , f (1, 2) = 3 – = 1
dx x 1
 h h   0.1 0.1  2.05
3. k2 =f  x0 + , y0 + k1  =f 1 + , 2+ (1)  =f (1.05, 2.05 ) = 3 – = 1.047619
 2 2   2 2  1.05

 h h   0.1 0.1 
4. k3 =f  x0 + , y0 + k2  =f 1 + , 2+ (1.047619)  = f (1.05, 2.05238095 )
 2 2   2 2 
2.05238095
=3– = 1.045351476
1.05
5. k4 = f ( x0 + h, y0 + hk3 ) = f (1 + 0.1, 2 + 0.1(1.045351476) ) = f (1.1, 2.1045351476)

2.1045351476
=3– = 1.086786229
1.1
h
6. yn +1 = yn + {k1 + 2k2 + 2k3 + k4 } and when n = 0:
6
h 0.1
y1 = y0 + {k1 + 2k2 + 2k3 + k4 } = 2 + { 1 + 2(1.047619) + 2(1.045351476) + 1.086786229}
6 6
0.1
=2+ { 6.272727181 } = 2.10454545
6

n xn yn
0 1.0 2.0
1 1.1 2.104545
2 1.2 2.216667
3 1.3 2.334615
4 1.4 2.457143
5 1.5 2.533333
1241 © 2014, John Bird
Lines 1 and 2 have now been completed in the above table

Let n = 1 to determine y2 :

dy y 2.104545
2. k1 = f ( x0 , y0 ) = f (1.1, 2.104545); since = 3 − , f (1.1, 2.104545) = 3 –
dx x 1.1
= 1.08677727
 h h   0.1 0.1 
3. k2 = f  x0 + , y0 + k1  = f 1.1 + , 2.104545 + (1.08677727)  = f (1.15, 2.15888386 )
 2 2   2 2 
2.15888386
=3– = 1.1227097
1.15
 h h   0.1 0.1 
4. k3 = f  x0 + , y0 + k2  = f 1.1 + , 2.104545 + (1.1227097)  = f (1.15, 2.1606805 )
 2 2   2 2 
2.1606805
=3– = 1.1211474
1.15
5. k4 = f ( x0 + h, y0 + hk3 ) = f (1.1 + 0.1, 2.104545 + 0.1(1.1211474) ) = f (1.2, 2.2166597)

2.2166597
=3– = 1.15278355
1.2
h
6. yn +1 = yn + {k1 + 2k2 + 2k3 + k4 } and when n = 0:
6
h
y1 = y0 + {k1 + 2k2 + 2k3 + k4 }
6
0.1
= 2.104545 + { 1.08677727 + 2(1.1227097) + 2(1.1211474) + 1.15278355}
6
0.1
= 2.104545 + { 6.72727045 } = 2.216667
6
Line 3 has now been completed in the above table. In a similar manner y3 , y4 and y5 can be

calculated.

1dy
2. Obtain a numerical solution of the differential equation: + 2y =
1 using the Runge–Kutta
x dx
method in the range x = 0(0.2)1.0, given the initial conditions that x = 0 when y = 1

1dy 1dy dy
If + 2y =
1 then = 1− 2 y and = x(1 − 2 y )
x dx x dx dx

1. x0 = 0, y0 = 1 and since h = 0.2, and the range is from x = 0 to x = 1.0, then

1242 © 2014, John Bird


= =
x1 0.2, =
x2 0.4, =
x3 0.6, =
x4 0.8and x5 1.0

Let n = 0 to determine y1 :

dy
2. k1 = f ( x0 , y0 ) = f (0, 1); since = x(1 − 2 y ) , f (0, 1) = 0(1 – 2) = 0
dx
 h h   0.2 0.2 
3. k2 =f  x0 + , y0 + k1  =f 0+ , 1+ (0)  =f ( 0.1, 1) = 0.1(1 – 2) = –0.1
 2 2   2 2 
 h h   0.2 0.2 
4. k3 = f  x0 + , y0 + k2  = f  0 + , 1+ (−0.1)  = f ( 0.1, 0.99 )
 2 2   2 2 
= 0.1(1 – 1.98) = –0.098
5. k4 = f ( x0 + h, y0 + hk3 ) = f ( 0 + 0.2, 1 + 0.2(−0.098) ) = f (0.2, 0.9804)

= 0.2(1 – 2(0.9804)) = –0.19216


h
6. yn +1 = yn + {k1 + 2k2 + 2k3 + k4 } and when n = 0:
6
h 0.2
y1 = y0 + {k1 + 2k2 + 2k3 + k4 } = 1 + { 0 + 2(−0.1) + 2(−0.098) + −0.19216 }
6 6
0.2
{ − 0.58816 } = 1 + = 0.980395
6

Let n = 1 to determine y2 :

dy
2. k1 = f ( x1 , y1 ) = f (0.2, 0.980395); since = x(1 – 2y),
dx
f (0.2, 0.980395) = 0.2(1 – 2(0.980395)) = –0.192158
 h h   0.2 0.2 
3. k2 = f  x1 + , y1 + k1  = f  0.2 + , 0.980395 + (−0.192158)  = f ( 0.3, 0.9611792 )
 2 2   2 2 
= 0.3(1 – 2(0.9611792) = –0.27670752
 h h   0.2 0.2 
4. k3 = f  x1 + , y1 + k2  = f  0.2 + , 0.980395 + (−0.27670752) 
 2 2   2 2 
= f ( 0.3, 0.952724248 ) = 0.3(1 – 2(0.952724248)) = –0.271634548

5. k4 = f ( x1 + h, y1 + hk3 ) = f ( 0.2 + 0.2, 0.980395 + 0.2(−0.271634548) )

= f (0.4, 0.92606809) = 0.4(1 – 2(0.92606809)) = –0.340854472


h
6. yn +1 = yn + {k1 + 2k2 + 2k3 + k4 } and when n = 1:
6
h
y2 = y1 + {k1 + 2k2 + 2k3 + k4 }
6

1243 © 2014, John Bird


0.2
= 0.980395 + { − 0.192158 + 2(−0.27670752) + 2(−0.271634548) + −0.340854472 }
6
0.2
= 0.980395 + { − 1.629696608 } = 0.926071779
6

This completes the third row of the table below. In a similar manner y3 , y4 and y5 can be

calculated.

dy y
3. (a) The differential equation: + 1 =− has the initial conditions that y = 1 at x = 2.
dx x

Produce a numerical solution of the differential equation, correct to 6 decimal places, using

the Runge–Kutta method in the range x = 2.0(0.1)2.5

4 x
(b) If the solution of the differential equation by an analytical method is given by: y= − ,
x 2

determine the percentage error at x = 2.2

dy y dy y y 
(a) If + 1 =− then =− − 1 =−  + 1
dx x dx x x 

1. x0 = 2, y0 = 1 and since h = 0.1, and the range is from x = 2.0 to x = 2.5, then

= =
x1 2.1, =
x2 2.2, =
x3 2.3, =
x4 2.4 and x5 2.5

Let n = 0 to determine y1 :

dy y  1 
2. k1 = f ( x0 , y0 ) = f (2, 1); since, =
−  + 1 , f (2, 1) = −  + 1 = –1.5
dx x  2 
 h h   0.1 0.1   0.925 
3. k2 = f  x0 + , y0 + k1  = f  2.0 + ,1.0 + (−1.5)  = f ( 2.05, 0.925 ) = −  + 1
 2 2   2 2   2.05 
= –1.451219512

1244 © 2014, John Bird


 h h   0.1 0.1 
4. k3 = f  x0 + , y0 + k2  = f  2.0 + , 1.0 + (−1.451219512)  = f ( 2.05, 0.927439024 )
 2 2   2 2 
 0.927439024 
= − + 1 = –1.45240928
 2.05 
5. k4 = f ( x0 + h, y0 + hk3 )= f ( 2.0 + 0.1, 1.0 + 0.1(−1.45240928) ) = f (2.1, 0.854759072)

 0.854759072 
= − + 1 = –1.40702813
 2.1 

h
6. yn +1 = yn + {k1 + 2k2 + 2k3 + k4 } and when n = 0:
6
h
y1 = y0 + {k1 + 2k2 + 2k3 + k4 }
6
0.1
= 1.0 + { − 1.5 + 2(−1.451219512) + 2(−1.45240928) + (−1.40702813) }
6
0.1
= 1.0 + { − 8.714285714 } = 0.854762
6
Let n = 1 to determine y2 :

dy y 
2. k1 = f ( x1 , y1 ) = f (2.1, 0.854762); since =
−  + 1 ,
dx x 
 0.854762 
f (2.1, 0.854762) = −  + 1 = –1.407029524
 2.1 
 h h   0.1 0.1 
3. k2 = f  x1 + , y1 + k1  = f  2.1 + , 0.854762 + (−1.407029524) 
 2 2   2 2 
 0.784410523 
= f(2.15, 0.784410523) = −  + 1 = –1.364842104
 2.15 
 h h   0.1 0.1 
4. k3 = f  x1 + , y1 + k2  = f  2.1 + , 0.854762 + (−1.364842104) 
 2 2   2 2 
 0.786519894 
= f ( 2.15, 0.786519894 ) = −  + 1 = –1.365823207
 2.15 
5. k4 = f ( x1 + h, y1 + hk3 ) = f ( 2.2, 0.854762 + 0.1(−1.365823207) )

 0.718179679 
= f (2.2, 0.718179679) = −  + 1 = –1.326445309
 2.2 
h
6. yn +1 = yn + {k1 + 2k2 + 2k3 + k4 } and when n = 1:
6
h
y2 = y1 + {k1 + 2k2 + 2k3 + k4 }
6

1245 © 2014, John Bird


0.1
= 0.854762 + { − 1.407029524 + 2(−1.364842104) + 2(−1.365823207) − 1.326445309 }
6
0.1
= 0.854762 + { − 8.194805455 } = 0.718182
6

This completes the third row of the table below. In a similar manner y3 , y4 and y5 can be

calculated and the results are as shown

4 x
(b) If y = − when x = 2.2, y = 0.718182
x 2

By the Runge–Kutta method, when x = 2.2, y = 0.718182 also

Hence, there is no error

1246 © 2014, John Bird

You might also like