1 Numerical Integration Formulas for Solving the Initial Value Problem of Ordinary Differential Equations Maitree Podisuk and Wannaporn Sanprasert Department of Mathematics and Computer Science King Mongkut’s Institute of Technology Chaokhuntaharn Ladkrabang Ladkrabang Bangkok 10520 THAILAND Abstract: In this paper, we will use four numerical integration formulas to solve the initial value problem of the ordinary differential equations by solving the integral equation instead of the ordinary differential equation. We will use these four formulas to find the numerical solutions of some examples and compare these results with the known Runge-Kutta formulas, Euler’s formula, Goeken-Johnson formula and Wu’s formula. Key-Words: Runge-Kutta Midpoint Trapezoidal Simpson Goeken Johnson Wu 1 Introduction The initial value problem of the ordinary differential equation is of the form y ( x ) f ( x, y), x [a , b] (1) with the initial condition y (a ) c . (2) If we divide the close interval [a , b] into n subintervals at the points x 0 a x1 x 2 ... x n b , where h x11 x i for i 0,1,2,..., n then some known numerical formulas for finding the numerical solution of the above equations at these points are (3) y m1 y m hf (x m , y m ) which is Euler formula which we shall denote by RK1, h y m1 y m K1 K 2 (4) 2 where K1 f (x m , y m ) K 2 f (x m h, y m hK 1 ) which is two points Runge-Kutta formula which we shall denote by RK2, h (5) y m 1 y m K 1 4K 2 K 3 6 where K1 f (x m , y m ) h h K 2 f (x m , y m K1 ) 2 2 K 3 f ( x m h, y m hK 1 2hK 2 ) which is three points Runge-Kutta formula which we shall denote by RK3. In 1999 Goeken and Johnson[1] introduced the following four points Runge-Kutta method for finding the numerical solutions of the autonomous initial value problem of the ordinary differential equation and it is of the form 5 27 125 K3 (6) y m1 y m K1 K 2 48 56 336 1 K4) 24 where K1 hf ( y m ) 1 1 K 2 hf ( y m K 1 hf y K 1 ) 3 18 152 252 K 3 hf ( y m K1 K2 125 125 44 hf y K 1 ) 125 19 22 25 K1 K 2 K 3 2 7 14 5 hf y K 1 ) 2 which we shall denote by GJ. K 4 hf ( y m 2 In 2003 Wu[2] introduced the two-step formula Runge-Kutta method for finding the numerical solution of the autonomous initial value problem of the ordinary differential equations and it is of the form 3 1 1 (7) y m1 y m y m1 h ( f m 2 2 2 121 8 23 f ( y m , hf m ) f (ym 192 11 192 44 44 8 hf m hf ( y m hf m )) 23 23 11 121 20 f ( y m 1 hf m 1 ) 192 29 23 44 hf ( y m1 hf m1 192 23 44 8 f ( y m 1 hf m 1 ))) 23 11 which we shall denote by WU. 2 Problem Formulation We know that the above equations (1)(2) are equivalent to the integral equation x (8) y( x ) c f ( t, y)dt . a By the method of successive approximation, the sequence y n (x) converges to the solution of the above differential equation where x (9) y m1 ( x ) c f ( t, y m ( t ))dt a So we will use the fact that the sequence y n (x) converges to the solution of the above differential equation to approximate the numerical solution at the point x a h by using the numerical approximation of a h (10) f (t, y(t ))dt . a The four numerical integration formulas that we will use in this paper are; b ab (11) a y(x)dx (b a) y 2 which is Midpoint formula, b 1 (12) y( x )dx (b a )y(a ) y(b) 2 a which is Trapezoidal formula, b 1 (13) y( x )dx (b a )y(a ) y(b) 2 a 1 (b a ) 2 y(a ) y(b) 12 which is the Modified Trapezoidal formula and b h ab (14) y( x )dx y(a ) 4 y( ) 6 2 a y(b) which is Simpson’s formula. By equation (11), (12), (13) and (14), we obtain four formulas which are h (15) y m 1 y m hf ( x m , y m bb)) 2 h where bb f ( x m , y m ) which we 2 shall denote by PS1, h y m 1 y m K 1 K 2 (16) 2 where K1 f (x m , y m ) K 2 hf (x m h, y m hf (x m , y m )) which we shall denote by PS2 , h y m 1 y m K 1 K 2 (17) 2 h2 AA BB 12 where K1 f (x m , y m ) K 2 hf (x m h, y m hf (x m , y m )) AA f x ( x m , y m ) f ( x m , y m )f y ( x m , y m ) BB f x ( x m h, y m hf ( x m , y m )) f ( x m h, y m hf ( x m , y m ))f y ( x m h, y m hf ( x m , y m )) which we shall denote by PS3 and h y m 1 y m f ( x m , y m ) (18) 6 h h 4f ( x m , y m f ( x m , y m )) 2 2 f (x m h, y m hf (x m , y m )) which we shall denote by PS4. 3 3 Examples There will be five examples in this section. We will use the above nine formulas to find the numerical solutions of these five examples. 3.1 Example 1 Find the numerical solution of the equation 4 (19) y , x [5,100] x ( x 4) with the initial condition y(5) 5. (20) The analytical solution of the above equation is y( x ) 5 ln( 5) ln( x ) ln( x 4) . The numerical results are in following table 1, 2 and 3. x 5.1, h 0.1 y 5.0755075525 RK1 RK2 RK3 PS1 PS2 @ PS3 PS4 RK1 RK2 RK3 PS1 PS2 PS3 PS4 Calculated y 5.0800000000 5.0756506239 5.0756507618 5.0754361150 5.0756506230 5.0756444162 5.0755076180 Table 1 x 5.1 h 0.0001 y 5.0755075525 Calculated y 5.0755119022 5.0755075527 5.0755076180 5.0755075525 5.0755075527 5.0755075527 5.0755075525 Table 2 Error 4.492447 10 3 1.430714 10 4 6.547634 10 8 7.143748 10 5 1.430714 10 4 1.368637 10 4 6.547634 10 8 Error 4.349691 10 6 1.891749 10 10 6.547634 10 8 5.820766 10 11 1.891749 10 10 1.891749 10 10 7.275958 10 12 RK1 RK2 RK3 PS1 PS2 PS3 PS4 x 100.0 h 0.0001 y 6.5686159179 Calculated y Error 6.5686559406 4.002266 10 5 6.5686159595 4.156027 10 8 6.5686159586 4.071626 10 8 6.5686159165 1.462467 10 9 6.5686159595 4.156027 10 8 4.156027 10 8 6.5686159595 6.5686159586 4.071626 10 8 Table 3 3.2 Example 2 Find the numerical solution of the equation xy 3 y , x [0,1.1] (21) 1 x2 with the initial condition y(0) 1. (22) The analytical solution of the above 1 equation is y( x ) . 2 3 2 1 x The numerical results are in following table 4, 5 and 6. x 0.1 , h 0.1 y 1.0050251887 Eerror Calculated y RK1 1.0000000000 5.025189 10 3 RK2 1.0049751860 5.000273 10 5 RK3 1.0050377575 1.256881 10 5 PS1 1.0049937617 3.142699 10 5 PS2 1.0049751860 5.000273 10 5 PS3 1.0049627790 6.240965 10 5 PS4 1.0049875698 3.761890 10 5 Table 4 4 RK1 RK2 RK3 PS1 PS2 PS3 PS4 x 0.1 h 0.0001 y 1.0050251887 Calculated y 1.0050200075 1.0050251887 1.0050251887 1.0050251877 1.0050251887 1.0050251887 1.0050251887 Table 5 Eerror 5.101223 10 6 3.637979 10 12 3.637979 10 12 1.818989 10 11 3.637979 10 12 3.637979 10 12 1.818989 10 12 RK1 RK2 RK3 PS1 PS2 PS3 PS4 x 1.1 h 0.0001 y 6.1100397659 RK1 RK2 RK3 PS1 PS2 PS3 PS4 Calculated y 6.0616904647 6.1100181633 6.1100398300 6.1100009806 6.1100181633 6.1099903436 6.1100066900 Table 6 Eerror 4.834930 10 2 2.160255 10 5 6.413757 10 5 3.878533 10 5 2.160255 10 5 4.942231 10 5 3.307559 10 5 3.3 Example 3 Find the numerical solution of the equation sin x 2 y y 2 , x [2,10] (23) x x with the initial condition y(2) 1. (24) The analytical solution of the above 4 cos 2 cos x equation is y( x ) . x2 The numerical results are in following table 7, 8 and 9. RK1 RK2 RK3 PS1 PS2 PS3 PS4 x 2.1 , h 0.1 y 0.9271426912 Calculated y 0.9227324357 0.9272135323 0.9271409569 0.9273232808 0.9272135323 0.9273578742 0.9272866980 Table 7 x 2.1 h 0.0001 y 0.9271426912 Calculated y 0.9271386264 0.9271426912 0.9271426912 0.9271426913 0.9271426912 0.9271426912 0.9271426913 Table 8 Eerror 4.410255 10 3 7.084114 10 5 1.256881 10 6 1.805896 10 4 7.084114 10 5 2.151830 10 4 1.440068 10 4 Eerror 4.064775 10 6 6.002665 10 11 2.728484 10 12 1.673470 10 10 6.002665 10 11 6.002665 10 11 1.300577 10 10 x 10.0 h 0.0001 y 0.0442292469 RK1 RK2 RK3 PS1 PS2 PS3 PS4 Calculated y 0.0442252473 0.0442292467 0.0442294669 0.0442292468 0.0442292467 0.0442292467 0.0442292467 Table 9 Eerror 3.999578 10 6 1.901412 10 10 2.329243 10 10 1.350600 10 10 1.901412 10 10 1.901412 10 10 1.527951 10 10 3.4 Example 4 Find the numerical solution of the equation xy y 2 , x [0,100] (25) y x2 with the initial condition y ( 0) 1 . (26) 5 The analytical solution of the above equation is y(x) x 2 x 4 1 . The numerical results are in following table 10, 11 and 12. x 0.1 , h 0.1 y 1.0050124371 Calculated y RK1 1.1000000000 RK2 1.0050505051 RK3 1.0050081470 PS1 1.0050125313 PS2 1.0050505051 PS3 1.0049572340 PS4 1.0050251872 Table 10 RK1 RK2 RK3 PS1 PS2 PS3 PS4 x 0.1 h 0.0001 1.0050124371 Calculated y 1.0050074292 1.0050124371 1.0050124371 1.0050124371 1.0050124371 1.0050124371 1.0050124371 Table 11 Eerror 9.498756 10 2 3.806794 10 5 4.290066 10 6 9.421456 10 8 7.084114 10 5 5.520314 10 5 1.275212 10 5 Eerror 5.007957 10 6 2.910383 10 11 9.094947 10 12 9.094947 10 12 2.910383 10 11 2.910383 10 11 1.818989 10 11 x 10.0 h 0.0001 y 0.0442292469 RK1 RK2 RK3 PS1 PS2 PS3 PS4 Calculated y 1414.2151819 1414.2151819 1414.2151819 1414.2151819 1414.2151819 1414.2151819 1414.2148829 Table 12 Eerror 1.619565 10 3 1.619574 10 3 1.619574 10 3 1.619574 10 3 1.619574 10 3 1.619574 10 3 1.318799 10 4 3.5 Example 5 Find the numerical solution of the equation (27) y y 3 , x [0,49.5] with the initial condition y(0) 0.1 (28) The analytical solution of the above 1 equation is y( x ) . 100 2x The numerical results are in following table 13, 14 and 15. RK1 RK2 RK3 GJ WU * PS1 PS2 PS3 PS4 RK1 RK2 RK3 GJ WU* PS1 PS2 PS3 PS4 x 0.1, h 0.1 y 0.10010015025 Calculated y Eerror 0.10010000000 1.502503 10 7 0.10010015015 1.002718 10 10 0.10010015025 1.136868 10 13 0.10010030624 1.559881 10 7 0.10010584213 5.691884 10 6 0.10010015008 1.753051 10 10 0.10010015015 1.002718 10 10 0.10010015002 2.255547 10 10 0.10010015010 1.502940 10 10 Table 13 x 0.1 h 0.0001 y 0.10010015025 Calculated y Eerror 0.10010015010 1.504077 10 10 0.10010025025 4.547474 10 13 0.10010025025 4.547474 10 13 0.10010025072 1.004693 10 7 0.10000010599 1.000443 10 4 0.10010025025 4.547474 10 13 0.10010025025 4.547474 10 13 0.10010025025 4.547474 10 13 0.10010025025 4.547474 10 13 Table 14 6 x 49.5 h 0.0001 y 1.0 Calculated y Error RK1 0.9996548547 3.451453 10 4 RK2 1.0000000038 3.845344 10 9 RK3 1.0000000088 8.847564 10 9 GJ 1.0003861906 3.861906 10 4 WU 17.085971673 16.085971673 * PS1 0.9999999987 1.309672 10 10 PS2 1.0000000038 3.845344 10 9 PS3 1.0000000019 1.939043 10 9 PS4 1.0000000013 1.329681 10 9 Table 15 * WU formula used y(0) and y(0.5h ) as the initial two points. 4 Conclusion All four new formulas are good numerical formulas for finding the numerical solutions of the initial value problem of the ordinary differential equations. These four new formulas will give us more freedom to find the way of finding the numerical solutions of the initial value problem of the ordinary differential equations. However we have to keep in mind that the above numerical solutions are just for only these five equations and the Wu formula is the 2-step formula. We strongly recommend the formula PS1 and the formula PS4. References: [1] David Goeken and Olin Johnson, Fifth-Order Runge-Kutta with Higher Order Derivative Approximations, Electronic Journal of Differential Equations, Vol.2, November 1999, pp.1-9. [2] Xinyuan Wu, A Class of RungeKutta of Order Three and Four with Reduced Evaluations of Function, Applied Mathematics and Computation, Vol.146, December 2003, pp.417-432.