Problem
Given the IVP
y(a) = y0
approximate y(b).
Assumptions
The function f(t, y) should be continuous in both variables.
Tools
We will use Taylor series and iteration.
Initial Conditions
Choose a value of n ≥ 1. Set h = (b − a)/n.
Set ti = a + ih for i = 0, 1, ..., n and let yi be the approximation of y(ti) for i = 1, ..., n.
Process
Multiple-step Euler's Method
For i = 1, 2, ..., n set
Multiple-step Heun's Method
For i = 1, 2, ..., n 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
For i = 1, 2, ..., n 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.
Approximating Intermediate Values
If a value of y(t) is required for a < t < b where t ≠ ti for any i, choose the surrounding four points (three if t < t1 or t > tn − 1), find the interpolating polynomial and evaluate this polynomial at the point t. Alternatively, calculate the appropriate cubic spline where the derivatives at the end points are given by f(a, y0) and f(b, yn), respectively.
Copyright ©2005 by Douglas Wilhelm Harder. All rights reserved.