Modified Euler's method
Starting from the form
,
one can find more Runge-Kutta methods of local truncation error of order 2. (More unknowns are needed with this form to raise the order to three). One such method is the Modified Euler's method:
;
>
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 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([0.4,t,t=0..1+f(0,1)*0.4],color=blue):
>
### WARNING: the definition of the type `symbol` has changed'; see help page for details
pl4:=plot([[0.4,1]],style=point,symbol=diamond):
> pl5:=plot([0.4+t,1+f(0.4,1)*t,t=-0.15..0.25],color=magenta):
> pl6:=plot({[0.4,t,t=0..1+(f(0,1)+f(0.4,1))/2*0.4],[t,1+(f(0,1)+f(0.4,1))/2*t,t=0..0.5]},color=black):
> display({pl.(1..6)});
>