To apply the RK45 method to a system of ODEs represented as:

$$\dot{\overline{z}}=\overline{F}$$

At each time step you should first compute

\begin{align*}

R_1 &= h\cdot \overline{F}(t_n,\overline{z}_n)\\

R_2&= h\cdot \overline{F}\left(t_n+\frac{1}{4}h,\overline{z}_n+ \frac{1}{4}R_1\right)\\

R_3&=h\cdot \overline{F}\left(t_n+\frac{3}{8}h,\overline{z}_n+ \frac{3}{32}R_1+ \frac{9}{32}R_2\right)\\

R_4&=h\cdot \overline{F}\left(t_n+\frac{12}{13}h,\overline{z}_n+\frac{1932}{2197}R_1-\frac{7200}{2197}R_2+\frac{7296}{2197}R_3\right)\\

R_5&=h\cdot \overline{F}\left(t_n+h,\overline{z}_n+\frac{439}{216}R_1-8R_2+\frac{3680}{513}R_3-\frac{845}{4104}R_4\right)\\

R_6&=h\cdot \overline{F}\left(t_n+\frac{1}{2}h,\overline{z}_n-\frac{8}{27}R_1+2R_2-\frac{3544}{2565}R_3+\frac{1859}{4104}R_4-\frac{11}{40}R_5\right)

\end{align*}

Then you have:

\begin{align*}

\overline{z^1}_{n+1}&=\overline{z}_n+\frac{25}{216}R_1+\frac{1408}{2565}R_3+\frac{2197}{4104}R_4-\frac{1}{5}R_5\\

&\\

\overline{z^2}_{n+1}&=\overline{z}_n+\frac{16}{135}R_1+\frac{6656}{12825}R_3+\frac{28561}{56430}R_4-\frac{9}{50}R_5+\frac{2}{55}R_6

\end{align*}

and my question is, to determine the error of this particular time step is it just the $\left \| \overline{z^1}_{n+1}-\overline{z^2}_{n+1} \right \|$ (norm of the difference between the two) or do you have a different formular for that?

Moreover, I would really appreciate if you can provide a suitable reference which contain this information. I have read several papers and it is a bit cumbersome….

## Best Answer

Yes, the 5th order method is considered exact enough that the difference to the 4th order method can serve as the error estimate for the 4th order method. This is valid as long as the step size is well within the stability region. When moving outside the boundary of the stability region, the error estimate will still grow, but become increasingly unrelated to the exact error.

You can test this by applying two different methods for error estimation, for instance using Richardson extrapolation based on the 4th order method.

The standard reference Hairer/Nørsett/Wanner:

"Solving ODE I"has a long explanation in section II.4:"Practical Error Estimation and Step Size Selection", comparing Richardson extrapolation and embedded methods; and after that a discussion of the design process for the Fehlberg 4(5) and Dormand-Prince 5(4) methods.