Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
The Runge-Kutta method, discovered by German mathematicians Carl Runge and Martin Kutta,
is a powerful fourth order method (i.e. the error is at most a fixed constant times the fourth power
of the step size, h), thus a great improvement over the Improved Eulers method. To justify this
scheme, we need to review Simpsons Rule for estimating a definite integral.
Simpsons Rule
Suppose we have a definite integral of the form
Z a+h
f (x) dx.
a
Two ways of approximating this area are (1) to use a trapezoid and (2) to use a rectangle whose
height is determined by the midpoint a+h/2. If we call these approximations T and M , respectively,
then their formulas are:
h
T = (f (a) + f (a + h))
2
and
M = hf (a + h/2).
It can be shown that the error in the trapezoid rule is given by
1
ET = h3 f 00 (a) + O(h4 )
24
and the error in the midpoint rule is given by
1
EM = h3 f 00 (a) + O(h4 )
12
where O(h4 ) means the remaining error terms are proportional to at least h4 . Simpsons rule is
precisely the right weighted average of T and M so that the leading error terms cancel. From the
above we see that this combination is
2M + T
.
3
Substituting in the formulas for M and T give
2(hf (a + h/2)) + h2 (f (a) + f (a + h))
2M + T
=
3
3
h
=
f (a) + 4f (a + h/2) + f (b)
6
Thus we have Simpsons Rule:
Z a+h
h
f (x) dx
f (a) + 4f (a + h/2) + f (b) .
6
a
y(x0 ) = y0
xk +h
f (x, y(x)) dx
y(xk+1 ) = y(xk ) +
xk
The corresponding numerical scheme depends on an approximation for the definite integral on the
RHS. We have seen that Eulers method arises from approximating this integral with a rectangle
of height f (xk ) and that the Improved Eulers method arises from approximating this integral by a
trapezoid. If we instead apply Simpsons Rule we get
h
(1)
y(xk+1 ) y(xk ) +
f (xk , y(xk )) + 4f (xk + h/2, y(xk + h/2)) + f (xk + h, yk+1 ) .
6
On the RHS we can approximate yk = y(xk ), but we are left with the problem of approximating
f (xk + h/2, y(xk + h/2))
and also
yk+1 .
We will need the following definitions to make our notation simpler:
Lk,1 = f (xk , yk )
Lk,2 = f xk + h/2, yk + (h/2)Lk,1
Lk,3 = f xk + h/2, yk + (h/2)Lk,2
Lk,4 = f xk + h, yk + hLk,3
Note that Lk,2 is the approximation of f at the midpoint using Eulers method and Lk,3 is another
approximation of f at the midpoint, using Lk,2 instead of Lk,1 . We average these two to get the
approximation
Lk,2 + Lk,3
f (xk + h/2, y(xk + h/2))
2
Now we use Lk,3 as our approximation of f at the midpoint to approximate
yk+1 yk + hLk,3 .
Plugging these back into equation (1) gives the Runge-Kutta method:
h
Lk,1 + 2Lk,2 + 2Lk,3 + Lk,4 .
yk+1 = yk +
6
I Example
Using the Runge-Kutta method with step size h = 0.1, determine an approximate value of the
solution at x = 1 for the initial value problem
y 0 = 2xy,
y(0) = 2
2
and compare the results with the value of the solution y(x) = 2et .
xk
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
yk
2
2.020100333
2.08162154
2.188348531
2.347021627
2.568050511
2.866657989
3.264630375
3.792956935
4.49580518
5.436540351
So the Runge-Kutta method with h = 0.1 estimates y(1) y10 5.43654035. From the
solution given above we see that the actual value of y(1) is
2