Example 1
Given the IVP y(1)(t) = 1 - t y(t) with y(0) = 1, approximate y(1) with one step.
First, let t0 = 0, y0 = 1, and h = 1. Thus, we calculate
K0 = f(0, 1) = 1
K1 = f(1, 2) = -1
½(K0 + K1) = 0
Therefore, approximation is y1 = y0 + h = 1 + 1⋅0 = 1. The actual value is 1.331309118 and therefore the absolute error is approximately 0.331, or approximately half that of what we found using Euler's method.
Example 2
Given the same IVP shown in Example 1, approximate y(0.5).
K0 = f(0, 1) = 1
K1 = f(0.5, 1.5) = 0.25
½(K0 + K1) = 0.625
Therefore, approximation is y1 = y0 + h = 1 + 0.5⋅0.625 = 1.3125. The actual value is 1.342841185 and therefore the absolute error is approximately 0.0303, or approximately 1/8 the error when we used h = 1.
Example 3
Repeat Examples 1 and 2 but with with the initial value y(0.5) = 2.5 and approximating y(1.5) and y(1.0).
First, let t0 = 0.5, y0 = 2.5, and h = 1. Therefore
K0 = f(0.5, 2.5) = -0.25
K1 = f(1.5, 2.5 - 1 ⋅ 0.25) = -2.375
½(K0 + K1) = -1.3125
Therefore, our approximation is y1 = y0 + h(-1.3125) = 2.5 + 1(-1.3125) = 1.1875. The actual value is 1.502483616 and therefore the absolute error is approximately 0.315.
Next, let t0 = 0.5, y0 = 2.5, and h = 0.5. Therefore
K0 = f(0.5, 2.5) = -0.25
K1 = f(1.5, 2.5 - 1 ⋅ 0.25) = -1.375
½(K0 + K1) = -0.8125
Therefore, our approximation is y1 = y0 + h(-0.8125) = 2.5 + 0.5 (-0.8125) = 2.09375. The actual value is 2.126611964 and therefore the absolute error is approximately 0.0329. Again, the error is approximately 1/8th that of the previous calculation where h = 1.
If we tabulate the errors for various values of h, as is shown in Table 1, we note that as h gets smaller, the error drops by almost exactly 1/8 each time we divide h by two.
Table 1. Errors when approximating y(t0 + h) for decreasing values of h.
h | Approximation of y(0.5 + h) | Error |
---|---|---|
1 | 1.1875 | 0.315 |
0.5 | 2.09375 | 0.0329 |
0.25 | 2.365234375 | 0.00338 |
0.125 | 2.450439453125 | 0.000366 |
0.0626 | 2.479766846 | 0.0000421 |
0.03125 | 2.491031647 | 0.00000502 |
0.01625 | 2.495804310 | 0.000000612 |
0.0078125 | 2.497974455 | 0.0000000755 |
0.00390625 | 2.499005325 | 0.00000000937 |
You will note that with each step, the error goes down by approximately a factor of 1/8.
Copyright ©2005 by Douglas Wilhelm Harder. All rights reserved.