Example

Consider the initial value problem

[Maple Math] , [Maple Math] in [Maple Math] and [Maple Math] .

With the exact solution [Maple Math] .

The Adams-Bashforth method of order three is given by

[Maple Math] ,

the Adams-Moulton Method of order three is given by

[Maple Math]

For [Maple Math] , we need [Maple Math] , [Maple Math] and [Maple Math] to start the calculation. Consider a step-size [Maple Math] , we will then use fourth-order Runge-Kutta to find estimates for [Maple Math] and [Maple Math] :

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

[Maple Math]

[Maple Math]

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

[Maple Math]

[Maple Math]

[Maple Math]

> for i from 0 to 2 do k[1]:=h*f(t[i],w[i]):k[2]:=h*f(t[i]+h/2,w[i]+k[1]/2):k[3]:=h*f(t[i]+h/2,w[i]+k[2]/2):k[4]:=h*f(t[i]+h,w[i]+k[3]): t[i+1]:=t[i]+h;w[i+1]:=w[i]+(k[1]+2*k[2]+2*k[3]+k[4])/6; print(t[i+1],w[i+1],abs(w[i+1]-y(t[i+1]))); od:

[Maple Math]

[Maple Math]

[Maple Math]

So we have our estimates for [Maple Math] and [Maple Math] . In addition, the estimate for [Maple Math] has been calculated as well, to compare with the results obtained from the predictor-corrector pair.

The Adams=Bashforth method then yields:

> wab[3]:=w[2]+(h/12)*(23*f(t[2],w[2])-16*f(t[1],w[1])+5*f(t[0],w[0]));

[Maple Math]

> errab:=abs(wab[3]-y(t[3]));

[Maple Math]

We now have a predicted value. The corrector step uses the Adams-Moulton Method:

> wam[3]:=w[2]+(h/12)*(5*f(t[3],wab[3])+8*f(t[2],w[2])-f(t[1],w[1]));

[Maple Math]

> erram:=abs(wam[3]-y(t[3]));

[Maple Math]

Which is clearly more accurate.

Why is this result not as accurate as the estimate obtained by the Fourth Order Runge-Kutta Method?

One option now is to iterate using the Adams-Moulton formula:

> wam2[3]:=w[2]+(h/12)*(5*f(t[3],wam[3])+8*f(t[2],w[2])-f(t[1],w[1]));

> erram2:=abs(wam2[3]-y(t[3]));

[Maple Math]

[Maple Math]

> wam3[3]:=w[2]+(h/12)*(5*f(t[3],wam2[3])+8*f(t[2],w[2])-f(t[1],w[1]));

> erram3:=abs(wam3[3]-y(t[3]));

[Maple Math]

[Maple Math]

> wam4[3]:=w[2]+(h/12)*(5*f(t[3],wam3[3])+8*f(t[2],w[2])-f(t[1],w[1]));

> erram4:=abs(wam4[3]-y(t[3]));

>

[Maple Math]

[Maple Math]

> wam5[3]:=w[2]+(h/12)*(5*f(t[3],wam4[3])+8*f(t[2],w[2])-f(t[1],w[1]));

> erram5:=abs(wam4[3]-y(t[3]));

>

[Maple Math]

[Maple Math]

As you can see, convergenc may be slow and may not improve the accuracy. Alternative options are to repeat the calculations using a smaller step-size or use a higher order predictor-corector pair.

In practice iteration is only seldom used.

>

>