# Finding correct step-size for the Euler method

I don't understand how to find the correct step-size $h$ for the Euler method. My script says the following:

One method consists in computing the numerical solution for an arbitrary $h$ and then $2h$. The Richardson extrapolation gives an estimate of $e = \max_t|y(t,2h)-y(t,h)|$ of the error. When the error is smaller than the tolerance, we keep the result and start from $2y(t,h)-y(t,h)$. If the error is larger we restart with $h/2$ until we reach the tolerance.

( $y(t,2h)$ means approximation with $2h$)

I don't understand why the Richardson extrapolation is mentioned. For what do I have to use it? Can I not just calculate $y(t,2h)$ and $y(t,h)$ and see the error?

• You need Richardson extrapolation to see that, in general, $2y(t,h)−y(t,2h)$ is correct to order $2$, while the terms themselves are correct to order $1$. – Lutz Lehmann Apr 11 '17 at 15:58

• Thank you very much. One small question though. Is the error $e= \max_t|y(t,2h)-y(t,h)|$ an approximation for the error $|y(t)-y(t,h)|$ or what is the link between them? – MarcE Apr 11 '17 at 16:05
• Thanks for the answer, I'm still struggling with the whole thing. I don't understand what is meant with "we can start from $2y(t,h)-y(t,2h)$". If I want do find the best $h$, then I look at the computed values of $y(t,2h)$ and $y(t,h)$ and compare the $N$ values. If the biggest error is smaller than the tolerance is that not the $h$ I need? – MarcE Apr 11 '17 at 18:05
• Just for empathy's sake: Stepsize choice is incredibly subtle; algorithms for robust adaptive stepsize choice in ODE solvers are very very complicated. But, there is no "best $h$". Smaller $h$ gives smaller error but longer compute time. – user14717 Apr 11 '17 at 18:31