Example

Consider the initial value problem

[Maple Math] .

Since [Maple Math] , [Maple Math] satisfies a Lipschitz Condition in [Maple Math] with Lipschitz constant [Maple Math] .

Also, here, the solution is given by [Maple Math] , and thus

> ddy1:=diff(1+exp(-t),t,t);

[Maple Math]

which over [Maple Math] has a maximum at [Maple Math] : [Maple Math] , with

[Maple Math] .

Using [Maple Math] , we find for the error bound:

[Maple Math] .

In practice:

> f:=(t,y)->-y+t+1;

[Maple Math]

> w[0]:=1;h:=0.1;t[0]:=0;

[Maple Math]

[Maple Math]

[Maple Math]

> for i from 0 to 9 do t[i+1]:=t[i]+h: w[i+1]:=w[i]+h*f(t[i],w[i]):err.i:=abs(t[i+1]+exp(-t[i+1])-w[i+1]): errb.i:=0.05*(exp(t[i+1])-1): print(t[i+1],err.i,errb.i); od:

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

The error bound is a considerable overestimate of the real error in this case. We can decrease the step size, since the error bound is proportional to [Maple Math] :

> h:=0.01;for i from 0 to 99 do t[i+1]:=t[i]+h: w[i+1]:=w[i]+h*f(t[i],w[i]):err.i:=abs(t[i+1]+exp(-t[i+1])-w[i+1]): errb.i:=0.005*(exp(t[i+1])-1): od:

[Maple Math]

> for i from 9 by 10 to 99 do print(t[i+1],err.i,errb.i) od:

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

>