Sei sulla pagina 1di 10

On A General Formula of Fourth Order Runge-Kutta

Method
Delin Tan
Zheng Chen

Abstract
In this paper, we obtain a general formula of Runge-Kutta method in order 4
with a free parameter t. By picking the value of t, it can generate many RK
methods in order 4 including some known results. Numerical calculation shows
that those new formulas have the same accuracy as the classical RK4 has.

I. Introduction and Main Results


The Runge-Kutta algorithm is used for solving the numerical solution of the
ordinary differential equation y( x) = f ( x, y ) with initial condition y ( x0 ) = w0 . In
about 1900, Runge and Kutta developed the following classical fourth order
Runge-Kutta iterative method
1
wk +1 = wk + ( K + 2K2 + 2K3 + K4 ) h,
6 1
(1)
K1 = f ( xk , wk ), ( 1 1
K 2 = f xk + h, wk + K1h ,
2 2 )
( 1
K3 = f xk + h, wk + K2 h ,
2
1
2 ) K 4 = f ( xk + h, wk + K3h ) .
4
which has the accumulative error in order of O(h ).
Since then, many mathematicians have tried to develop more Runge-Kutta
like methods in a variety of directions. In 1969, R. England [1] developed
another fourth order Runge-Kutta method (See the book of L. F. Shampine, R.
C. Allen and S. Pruess [2] )
1
wk +1 = wk + ( K + 4K3 + K 4 ) h,
6 1
(2) K = f ( x , w ),
1 k k ( 1 1
K 2 = f xk + h, wk + K1h ,
2 2 )
( 2
1
4
1
4 )
K3 = f xk + h, wk + K1h + K 2 h , K4 = f ( xk + h, wk K2 h + 2 K3h ) .
1

Although the higher order of Runge-Kutta methods can increase the error
accuracy, but it would need to pay the cost of calculation complexity. Therefore
the most mathematicians think that the fourth order Runge-Kutta method is the
most efficient method to solve numerical solution for IVP. It is naturally to ask:
Do there exist other fourth order Runge-Kutta methods? If yes, then what are
they look like? In this paper, we obtain a general formula fourth order Runge-
Kutta method with a free parameter as the following

Journal of Mathematical Sciences & Mathematics Education Vol. 7 No. 2 1


1
wk +1 = wk + K1 + ( 4 t ) K 2 + tK3 + K 4 h,
6
K1 = f ( xk , wk ),
(3)
(
K 2 = f xk + h, wk + K1h ,)1
2
1
2

K = f ( x + h, w + ( ) K h + K h ) ,
1 1 1 1
3 k 2 k 2 t 1 t 2

K = f ( x + h, w + (1 ) K h + K h ) ,
t t
4 k k 2 2 2 3

where t is a free parameter.


Remark 1: Pick t = 2, then (3) becomes the classical Runge-Kutta method (1).
Remark 2: Pick t = 4, then (3) becomes Englands Runge-Kutta method (2).
Remark 3: Pick t = 1, we get a new formula for Runge-Kutta method
1
wk +1 = wk + ( K + 3K2 + K3 + K4 ) h,
6 1
K1 = f ( xk , wk ),
(4)
( 1
)
K 2 = f xk + h, wk + K1h ,
2
1
2

K = f ( x + h, w K h + K h ) ,
1 1
3 k 2 k 2 1 2

K = f ( x + h, w + K h + K h ) .
1 1
4 k k 2 2 2 3

Remark 4: Pick t = 3 we get the second new formula for Runge-Kutta method
1
wk +1 = wk + ( K + K2 + 3K3 + K 4 ) h,
6 1
K1 = f ( xk , wk ),
(5)
( )
K 2 = f xk + h, wk + K1h ,
1
2
1
2

K = f ( x + h, w + K h + )
1 1 1
3 k k 1 K2h ,
2 6 3

K = f ( x + h, w K h + K h).
1 3
4 k k 2 2 2 3

Remark 5: Pick t = 5, we get the third new formula for Runge-Kutta method
1
wk +1 = wk + ( K K2
6 1
+ 5K3 + K 4 ) h,
K1 = f ( xk , wk ),
(6) ( )
K 2 = f xk + h, wk + K1h ,
1
2
1
2

K = f ( x + h, w + K h + K h ) ,
1 3 1
3 k 2 k 10 1 5 2

K = f ( x + h, w K h + K h ) .
3 5
4 k k 2 2 2 3

Journal of Mathematical Sciences & Mathematics Education Vol. 7 No. 2 2


II. Numerical Computing Tests
With the same step value of h, we use the different fourth order Runge-Kutta
methods, including the classical one, to calculate the numerical solution for
several differential equations with initial value condition at x = 0. Then
comparing to the real analytic solutions to estimate the relative error at x = 4.
Our first example is to calculate the numerical solution for
y = y x 2 + 1 (0 x 4) with y (0) = 3 and h = 0.2.
Comparing to the analytic solution y = 2e x + x 2 + 2 x + 1 at x = 4, we obtain the
following results:

RK4 methods Classical R. England Formula (4) Formula (5) Formula (6)

Relative errors at x=4 0.0049% 0.0049% 0.0049% 0.0049% 0.0049%

Our second example is to calculate the numerical solution for


y = xy x3 (0 x 4) with y (0) = 3 and h = 0.2.
2
Comparing to the analytic solution y = e x /2
+ x 2 + 2 , we obtain the following
results:

RK4 methods Classical R. England Formula (4) Formula (5) Formula (6)

Relative errors at x=4 0.0053% 0.0053% 0.0053% 0.0053% 0.0053%

Our last example is to calculate the numerical solution for the second order
differential equation
y = y + 2sin x (0 x 4) with y (0) = 1, y(0) = 0 and h = 0.2.
y
Define vector variable Y = and apply the different fourth order Runge-
y
Kutta methods to the following vector differential equation
dY 1
= f ( x, Y ) with initial condition Y (0) =
dx 0
0 1 0
where f ( x, Y ) =
Y+
1 0 2sin x
After comparing to the analytic solution y = e x sin x , we get the following
results
RK4 methods Classical R. England Formula (4) Formula (5) Formula (6)

Relative errors at x=4 0.0051% 0.0051% 0.0051% 0.0051% 0.0051%

The above calculating results show that the new fourth order Runge-Kutta
methods formulas (4) (5) and (6) have the exactly same error accuracy as the
classical method (1) does.

Journal of Mathematical Sciences & Mathematics Education Vol. 7 No. 2 3


III. Lemma
To derive the above general formula (3), we need the following lemma:
Lemma: Suppose that a, b, c, d, p1, p2, p3, q1, q2a, q2b, q3a and q3b are real
numbers and function f(x, y) is continues in a neighborhood of a point (x0, y0).
Let y = y(x) be a solution of differential equation y( x) = f ( x, y ) with initial
condition y ( x0 ) = y0 . Define
K1 = f ( x, y ) ,
(7) K 2 = f ( x + p1h, y + q1 K1h),
K 3 = f ( x + p2 h, y + q2 a K1h + q2b K 2 h),
K 4 = f ( x + p3 h, y + q3a K 2 h + q3b K 3 h)
For small h > 0, if
(8) y ( x + h) = y ( x) + (aK1 + bK 2 + cK 3 + dK 4 )h + O ( h5 )
is true for any continuous function f(x, y) in the domain of (x, y), then
a + b + c + d = 1,
p1 = q1 ,
p2 = q2 a + q2 a ,
p3 = q3a + q3b
(9)
2(bp1 + cp2 + dp3 ) = 1,
3(bp12 + cp22 + dp32 ) = 1,
4(bp13 + cp23 + dp33 ) = 1,
6 ( cp1q2b + dp1q3a + dp2 q3b ) = 1,
24dp1q2b q3b = 1
4 ( p1 + p2 + 6dp1 p3q3a + 6dp2 p3 q3b 6dp1 p2 p3 ) = 5.
Proof: First pick y(x) = x, then f(x, y) = y'(x) = 1 and K1 = K2 = K3 = K4 =1. Plug
them into (8) we get
x + h = x + ( a + b + c + d )h + O( h5 ).
Therefore we obtain
(11) a + b + c + d = 1.
y . Then
Still consider , but setup f ( x, y ) = y( x) =
x
y y + q1 K1h x + q1h
K1 = = 1, K2 = = ,
x x + p1h x + p1h
x + q2 a K1h + q2b K 2 h x + q3a K 2 h + q3b K3 h
K3 = , K4 = .
x + p2 h x + p3 h
To make the point ( xk , wk ) on the solution line y = x, K2 should be equal one.
Therefore, the only possible relation between p1 and q1 is
(12) p 1 = q 1.

Journal of Mathematical Sciences & Mathematics Education Vol. 7 No. 2 4


Then x + ( q2 a + q2b ) h
K3 =
x + p2 h
For the same arguments on K3, we obtain
(13) p2 = q2 a + q2 b .

x + ( q3a + q3b ) h
Then K4 =
x + p3h
Similarly, we obtain
(14) p3 = q3a + q3b .

If pick y(x) = x2 and setup f(x, y) = y'(x) = 2x, then


K1 = 2 x, K 2 = 2( x + p1h ), K 3 = 2( x + p2 h ), K 4 = 2( x + p3 h ) .
Plug into (8)
( x + h) 2 = x 2 + h [ 2ax + 2b( x + p1h) + 2c( x + p2 h) + 2d ( x + p3 h)] + O (h5 )
= x 2 + 2(a + b + c + d ) xh + 2 ( bp1 + cp2 + dp3 ) h 2 + O (h5 ).
Then we get
(15) 2 ( bp1 + cp2 + dp3 ) = 1 .

Next pick y(x) = x3 and setup f(x, y) = y'(x) = 3x2, then


K1 = 3x 2 , K 2 = 3( x + p1h) 2 , K 3 = 3( x + p2 h) 2 , K 4 = 3( x + p3 h) 2 .
Plug into (8)
( x + h)3 = x3 + h 3ax 2 + 3b( x + p1h) 2 + 3c( x + p2 h) 2 + 3d ( x + p3h) 2 + O( h5 )
= x3 + 3 x 2 h + 3 xh 2 + 3 ( bp12 + cp22 + dp32 ) h3 + O (h5 )
Then we get
(16) 3 ( bp12 + cp22 + dp32 ) = 1

If pick y(x) = x4 and setup f(x, y) = y'(x) = 4x3, then


K1 = 4 x3 , K 2 = 4( x + p1h)3 , K3 = 4( x + p2 h)3 , K 4 = 4( x + p3h)3 .
Plug into (8)
( x + h) 4 = x 4 + h 4ax3 + 4b( x + p1h)3 + 4c( x + p2 h)3 + 4d ( x + p3 h)3 + O(h5 )
= x 4 + 4 x3 h + 6 x 2 h2 + 4 xh3 + 4 ( bp13 + cp23 + dp33 ) h 4 + O(h5 ).
Then we get
(17) 4 ( bp13 + cp23 + dp33 ) = 1 .

Again pick y ( x ) = x 3 but setup f ( x, y ) = y( x) =


3 y . Then
K1 = 3 x 2 and
x

Journal of Mathematical Sciences & Mathematics Education Vol. 7 No. 2 5


3 ( y + q1 K1h ) 3 ( x + 3 p1 x h )
3 2

K2 = =
x + p1h x + p1h
= 3 x 2 + 2 p1 xh 2 ( p1h )
2
+ O (h3 )
3 ( y + q2 a K1h + q2b K 2 h )
K3 =
x + p2 h
3 ( x3 + 3q2 a x 2 h + 3q2b x 2 h + 6 p1q2b xh 2 )
= + O(h3 )
x + p2 h
3 ( x3 + 3 p2 x 2 h + 6 p1q2b xh 2 )
= + O ( h3 )
x + p2 h
= 3 x + 2 p2 xh 2 ( p2 h ) + 6 p1q2b h 2 + O( h3 )
2 2

3 ( y + q3a K 2 h + q3b K 3h )
K4 =
x + p3h
3 ( x 3 + 3q3a x 2 h + 6 p1q3a xh 2 + 3q3b x 2 h + 6 p2 q3b xh 2 )
= + O (h3 )
x + p3h
3 x 3 + 3 p3 x 2 h + 6 ( p1q3a + p2 q3b ) xh 2
= + O (h3 )
x + p3h
= 3 x 2 + 2 p3 xh 2 x ( p3h ) + 6 ( p1q3a + p2 q3b ) h 2 + O( h3 )
2

Plug into (8)


( x + h)3 = x 3 + 3ax 2 h + 3b x 2 + 2 p1 xh 2 ( p1h )
2
h

+ 3c x 2 + 2 p2 xh 2 ( p2 h ) + 6 p1q2b h 2 h
2

+ 3d x 2 + 2 p3 xh 2 x ( p3 h ) + 6 ( p1q3 a + p2 q3b ) h 2 h + O( h 4 )
2

= x 2 + 3(a + b + c + d ) x 2 h + 6 ( bp1 + cp2 + dp3 ) xh 2


+ 3 2 ( bp12 + cp22 + dp32 ) + 6 ( dp1q3 a + dp2 q3b + cp1q2b ) h3 + O ( h 4 ).
Then we get
3 2 ( bp12 + cp22 + dp32 ) + 6 ( dp1q3a + dp2 q3b + cp1q2b ) = 1
From (17)
18 ( dp1q3a + dp2 q3b + cp1q2 b ) = 6 ( bp12 + cp22 + dp32 ) + 1 = 3
Therefore
(18) 6 ( cp1q2b + dp1q3a + dp2 q3b ) = 1 .

Journal of Mathematical Sciences & Mathematics Education Vol. 7 No. 2 6


4y
Still consider y ( x ) = x 4 and setup f ( x, y ) = y( x) = , then K1 = 4 x 3 and
x
4 ( y + q1 K1h )
K2 =
x + p1h
4 ( y + q2 a K1h + q2b K 2 h )
K3 =
x + p2 h

=
(
4 x 4 + 4q2 a x3h + q2b 4 x3 + 12 p1 x 2 h 12 ( p1h ) x h
2
) + O(h 4 )
x + p2 h
4 x 4 + 4 p2 x 3h + 12 p1q2b x 2 h 2 12 p12 q2b xh3
= + O( h 4 )
x + p2 h
= 4 x 3 + 3 ( p2 h ) x 2 3 ( p2 h ) x + 3 ( p2 h )
2 3

+4 12 p1q2b xh 2 12 p1 p2 q2b h3 12 p12 q2b h3 + O(h 4 ).


Because
y + q3a K 2 h + q3b K 3h
= x 4 + 4q3a x 3 + 3 ( p1h ) x 2 3 ( p1h ) x h + O ( h 4 )
2

+4q3b x 3 + 3 ( p2 h ) x 2 3 ( p2 h ) x + 12 p1q2b xh 2 h + O (h 4 )
2

= x 4 + 4q3 x 3h + 12 p1q3a x 2 h 2 12 p12 q3a xh3 + 4q4 x 3 h


+12 p2 q3b x 2 h 2 12 p22 q3b xh3 + 48 p1q2b q3b xh3 + O (h 4 )
= x 4 + 4 p3 x 3 h + 12 ( p1q3a + p2 q3b ) x 2 h 2 12 ( p12 q3a + p22 q3b ) xh3
+48 p1q2b q3b xh3 + O ( h 4 ).
Then
4 ( y + q3a K 2 h + q3b K 3 h )
K4 =
x + p3 h
4 x 4 + 4 p3 x 3 h + 12 ( p1q3a + p2 q3b ) x 2 h 2 12 ( p12 q3a + p22 q3b ) xh3 + 48 p1q2b q3b xh3
= + O(h 4 )
x + p3h
= 4 x 3 + 3 ( p3 h ) x 2 3 ( p3 h ) x + 3 ( p3h ) + 12 ( p1q3a + p2 q3b ) xh 2 12 ( p1q3a + p2 q3b ) p3 h3
2 3

+4 12 ( p12 q3a + p22 q3b ) h3 + 48 p1q2b q3b h3 + O(h 4 ).

Plug into (8)

Journal of Mathematical Sciences & Mathematics Education Vol. 7 No. 2 7


( x + h) 4 = x 4 + 4ax3 h + 4b x3 + 3 p1 x 2 h 3 ( p1h ) x + 3 ( p1h ) h
2 3

+ 4c x3 + 3 ( p2 h ) x 2 3 ( p2 h ) x + 3 ( p2 h ) + 12 p1q2b xh 2 12 p1 p2 q2b h3 12 p12 q2b h3 h


2 3

+ 4d x3 + 3 ( p3 h ) x 2 3 ( p3h ) x + 3 ( p3 h ) + 12 ( p1q3a + p2 q3b ) xh 2 h


2 3

+ 4d 12 ( p1q3a + p2 q3b ) p3 h3 12 ( p12 q3a + p22 q3b ) h3 + 48 p1q2b q3b h3 h + O (h5 )

= x 4 + 4 ( a + b + c + d ) x 3 h + 12(bp1 + cp2 + dp3 ) x 2 h 2


+4 3 ( bp12 + cp22 + dp22 ) + 12 ( cp1q2b + dp1q3a + dp2 q3b ) xh3 + 12 bp13 + cp23 + dp33 h 4
+4 12 p1 ( cp1q2b + dp1q3a + dp2 q3b ) 12 p2 ( cp1q2b + dp1q3a + dp2 q3b ) h 4
+4 [ 12dp1 p3 q3a 12dp2 p3q3b + 12dp1 p2 p3 + 48dp1 p2 q3b ] h 4 + O( h5 )
= x 4 + 4 x 3h + 6 x 2 h 2 + 4 xh3 h 4 + 3h 4 + 4 ( 2 p1 2 p2 ) h 4
+4 [ 12dp1 p3 q3a 12dp2 p3q3b + 12dp1 p2 p3 + 48dp1q2b q3b ] h 4 + O (h5 )
Therefore
3 + 4 ( 2 p1 2 p2 + 12dp1 p2 q3a 12dp1 p3 q3 a 12dp2 p3 q3b + 48dp1q2 b q3b ) = 1
We obtain
(18)
4 ( p1 + p2 + 6dp1 p3 q3a + 6dp2 p3 q3b 6dp1 p2 p3 24dp1q2b q3b ) = 1
Thus, we have obtained all equations in (9) of the lemma.

Remark 1: Equations in lemma are the necessary conditions to make the RK4
constants a, b, c, d, p1, p2, p3, q1, q2a, q2b, q3a and q3b. They might not be enough
make (8) to be true for some f(x,y).

Remark 2: Equations in (9) plus the following equations


24dp1q2 b q3b = 1
(21) 6 ( cp q + dp q + dp q ) = 1,
1 2b 1 3a 2 3b

8(cp1 p2 q2b + dp1 p3 q3a + dp2 p3 q3b ) = 1


would be enough to make (8) to be true for all f(x,y). See the book of J. H.
Mathews and K. D. Fink [3].

IV. Derivation the General RK4 formulas


The total number of questions in systems (9) and (21) is 12. The number of all
unknown constants is also 12. Therefore, it could have only one solution for
constants a, b, c, d, p1, p2, p3, q1, q2a, q2b, q3a and q3b theoretically. How if we set
up p1= p2 or p1= p3 or p1= p3, then the rank of the following equation system

Journal of Mathematical Sciences & Mathematics Education Vol. 7 No. 2 8


2(bp1 + cp2 + dp3 ) = 1
3(bp12 + cp22 + dp32 ) = 1
4(bp13 + cp23 + dp33 ) = 1
Would be reduced to two, then we would get a free parameter. By a tedious
analyzing, we have found that the only possible case is p1= p2. The further
calculation reveals that this common value is only possibly to be 1/2 or 1/3. If
p1 = p2 = 1/2, we can calculate to get p3=1. If p1= p2 = 1/3, we can calculate to
get p3 = 5/6. However, the second choice p1= p2 = 1/3, p3 = 5/6 is contradiction to
equation system (21). We omit the detail calculation here.
1
Now we choose p1 = p2 = and p3 = 1 to get
2

b + c + 2d = 1 2
3 3
b+c = 1
3
b+ c + 3d =1 a= .
4 4 1 6
1 1
d=
6
b+ c + 4d =1
2 2
Then the equation 6 ( cp1q2 b + dp1q3a + dp2 q3b ) = 1 becomes

6 ( 1
2
cq2b +
1
q
12 3a
+
1
q
12 3b ) =1 .

Because q3a + q3b = p3 = 1 , we get

6 ( 1
cq
2 2b
+
1
12 ) =1 cq2b =
1
6
1
Set q2b = and t as a free parameter. We obtain
t
t 2
c = and b = c = 4 t
6 3
1
6
( )
From the equation

4 ( p1 + p2 + 6dp1 p3 q3a + 6dp2 p3 q3b 6dp1 p2 p3 24dp1q2 b q3b ) = 1 ,


we get

( 1
4 1 + q3a + q3b q3b = 1.
2
1
2
1
4
2
t )
4 ( 5
4
2
q3b = 1.
t )
t t
Therefore q3b = and q3a = 1
2 2
Then we obtain the general RK4 formula with a parameter t

Journal of Mathematical Sciences & Mathematics Education Vol. 7 No. 2 9


1
wk +1 = wk + K1 + ( 4 t ) K 2 + tK3 + K 4 h,
6
K1 = f ( xk , wk ),

( 1
K2 = f xk + h, wk + K1h ,
2 ) 1
2

K = f ( x + h, w + ( ) K h + K h ) ,
1 1 1 1
3 k 2 k 2 t 1 t 2

K = f ( x + h, w + (1 ) K h + K h ) .
t t
4 k k 2 2 2 3

Moreover, we can check that all constants in this formula satisfy conditions of
(21) for any constant t. That proves that is a general Runge-Kutta method in
order of 4. Actually, there is no other Runge-Kutta method in order of 4 under
the formation (7).

Delin Tan, Ph.D., Southern University at New Orleans, USA


Zheng Chen , Ph.D., Southern University at New Orleans, USA

References
[1] R. England, Error estimate for Runge-Kutta type solutions of ordinary
differential equation. Computer Journal 12 (1969) 166-170.
[2] L. F. Shampine, R. C. Allen and S. Pruess, Fundamentals of Numerical
Computing, (1997) John Wiley & Sons.
[3] J. H. Mathews and K. D. Fink, Numerical Methods: Using Matlab, Fourth
Edition, (2004), Prentice-Hall Pub. Inc.

Journal of Mathematical Sciences & Mathematics Education Vol. 7 No. 2 10

Potrebbero piacerti anche