Given the IVP y^{(1)}(*t* = -21 y(*t*) + *e*^{-t} y(0) = 0, to approximate y(*t*) on [0, 2] with *h* = 0.1, we can do:

N := 20: t[0] := 0: h := 0.1: f := (t, y) -> -21*y + exp(-t): for i from 1 to N do t[i] := t[0] + i*h; end do: y[0] := 0: for i from 1 to N do y[i] := fsolve( upsilon - y[i - 1] = h*f( t[i], upsilon ) = 0 ); end do: plots[pointplot]( [seq( [t[i], y[i]], i = 0..N )] );

Here we let Maple's `fsolve` routine fine the root of our equation.

Copyright ©2005 by Douglas Wilhelm Harder. All rights reserved.