Heun's method
Starting from the same form
,
one can find Heun's method, again of order 2:
;
>
The plot below illustrates its graphical interpretation: use the slope at the starting point to predict the value at
, then calculate the slope at this estimated point and use the weighted average of both to finalise your estimate.
> y:=t->t+exp(-t);
> f:=(t,y)->-y+t+1;
> with(plots):pl1:=plot(y(t),t=0..1,y=0.9..1.3):
> pl2:=plot([t,1+f(0,1)*t,t=0..0.4],color=blue):
> pl3:=plot([2*0.4/3,t,t=0..1+f(0,1)*0.4*2/3],color=blue):
>
### WARNING: the definition of the type `symbol` has changed'; see help page for details
pl4:=plot([[0.4*2/3,1]],style=point,symbol=diamond):
> pl5:=plot([0.4*2/3+t,1+f(0.4*2/3,1)*t,t=-0.15..0.25],color=magenta):
> pl6:=plot({[0.4,t,t=0..1+(f(0,1)+3*f(0.4*2/3,1))/4*0.4],[t,1+(f(0,1)+3*f(0.4*2/3,1))/4*t,t=0..0.5]},color=black):
> display({pl.(1..6)});
>