Example 2:
Use Eulers method to solve for y[0.1] from
y' = x + y + xy,
y(0) = 1 with h = 0.01 also estimate how small
h would need to obtain four-decimal accuracy.
Solution :
f(x, y) = x + y + xy,
y1 = y0 + h f(x0, y0) =
1.0 + .01*(0 + 1 + 0*1) = 1.01
y2 = y1 + h f(x1, y1) =
1.01 + .01*(0.01 + 1.01 + 0.01*1.01) =1.02
y3 = y2 + h f(x2, y2) =
1.02 + .01*(0.02 + 1.02 + 0.02*1.02) =1.031
y4 = y3 + h f(x3, y3) =
1.031 + .01*(0.03 + 1.031 + 0.03*1.031) =1.042
y5 = y4 + h f(x4, y4) =
1.042 + .01*(0.04 + 1.042 + 0.04*1.042) = 1.053
y6 = y5 + h f(x5, y5) =
1.053 + .01*(0.05 + 1.053 + 0.05*1.053) = 1.065
y7 = y6 + h f(x6, y6) =
1.065 + .01*(0.06 + 1.065 + 0.06*1.065) = 1.076
y8 = y8 + h f(x7, y7) =
1.076 + .01*(0.07 + 1.076 + 0.07*1.076) = 1.089
y9 = y9 + h f(x8, y8) =
1.089 + .01*(0.08 + 1.089 + 0.08*1.089) = 1.101
y10 = y10 + h f(x9, y9)
= 1.101 + .01*(0.09 + 1.101 + 0.09*1.101) = 1.114
error in the approximation = ( h2/2 ) f''(x),
where 0 < x <0.1
= 0.00005 f''(x)