Given the IVP
y(a) = y0
where we want to estimated y(b) for b > a, we can apply the same strategy we used for the composite-trapezoidal rule:
Break the interval [a, b] into n sub-intervals and define h = (b - a)/n. Then set ti = a + ih for i = 0, 1, ..., n. Therefore t0 = a and tn = b.
Now, y0 is the initial value so let yi represent the approximation of y(ti) for i = 1, 2, ..., n.
Using any of the three techniques we've seen, Euler's, Heun's, or 4th-order Runge Kutta, we may now proceed as follows:
For i from 1 to n:
Approximate yi using yi − 1.
More specifically:
Multiple-step Euler's Method
Calculate
for i = 1, 2, ..., n.
Multiple-step Heun's Method
Calculate
K0 = f(ti − 1, yi − 1)
K1 = f(ti, yi − 1 + h K0)
and set yi = yi − 1 + h (K0 + K1)/2.
4th-order Runge Kutta
Calculate
K0 = f(ti − 1, yi − 1)
K1 = f(ti − 1 + ½h, yi − 1 + ½h K0)
K2 = f(ti − 1 + ½h, yi − 1 + ½h K1)
K3 = f(ti, yi − 1 + h K2)
and set yi = yi − 1 + h (K0 + 2 K1 + 2 K2 + K3)/6.
Copyright ©2005 by Douglas Wilhelm Harder. All rights reserved.