Example 1:
Find y(0.5) if y is the solution of IVP y'
= -2x-y, y(0) = -1 using Euler's method with step length
0.1.
Also find the error in the approximation.
Solution:
f(x, y) = -2x - y,
y1 = y0 + h f(x0, y0) =
-1 + 0.1* (-2*0 - (-1)) = -0.8999
y2 = y1 + h f(x1, y1) =
-0.8999 + 0.1* (-2*0 - (-0.8999)) = -0.8299
y3 = y2 + h f(x2, y2) =
-0.8299 + 0.1* (-2*0 - (-0.8299)) = -0.7869
y4 = y3 + h f(x3, y3) =
-0.7869 + 0.1* (-2*0 - (-0.7869)) = -0.7683
y5 = y4 + h f(x4, y4) =
-0.7683 + 0.1* (-2*0 - (-0.7683)) = -0.7715
Truncation error in the approximation = ( h2/2 ) f''(x),
where 0 < x <0.5
= 0.005 f''(x)