# What is the formula for the local truncation error in RK4?

The local truncation error of a one-step ODE solver is defined to be $$e_{i+1} = \lvert y(t_{i+1}) - \tilde{y}_{i+1}\rvert,$$ the absolute value of the difference between the correct solution of the "one-step initial value problem", $$y(t_{i+1})$$, and the value provided by the solver assuming that $$y_i$$ is exact, $$\tilde{y}_{i+1}$$.

To find the local truncation error in Euler's method, I do the following.

By Taylor's theorem,

$$\exists c \in [t_i, t_{i+1}], \quad y(t_{i+1}) = y(t_i + h) = y(t_i) + hy'(t_i) + \frac{h^2}{2}y''(c).$$

By Euler's method,

$$y_{i+1} = y(t_i) + hf(t_i, y_i) = y(t_i) + hy'(t_i).$$

Therefore,

$$e_{i+1} = \Big\lvert \frac{h^2}{2} y''(c) \Big\rvert = \frac{Mh^2}{2}, \: M = \lvert y''(c) \rvert.$$

What is the formula for the local truncation error in RK4 and how can it be derived? Moreover, does it have practical use when trying to bound the global truncation error in the solution to an initial value probelm or are these error bounds usually estimated by other techniques?

• @KClaesson The local truncation error is not defined exactly as you described. $|y(t_{i+1})-y_{i+1}|$ is the global error. The local error is given by $|y(t_{i+1}) - \tilde y_{i+1}|$, where $\tilde y_{i+1}$ is the value provided by the solver assuming that $y_i$ is exact. May 16, 2019 at 8:31
• @PierreCarre That is what I was trying to say by "one-step initial value problem", but I agree that your way of phrasing it is significantly clearer. May 16, 2019 at 8:33
• @KClaesson I would suggest that you try first with RK2. You will need to use Taylor's formula in $\mathbb{R}$ and $\mathbb{R}^2$. You will also need the chain rule to relate the total derivative of $f$ with its partial derivatives with respect to $y$ and $t$. May 16, 2019 at 8:38
• It is easier to only consider autonomous equations. If necessary, the time is included as a component with derivative constant $1$. Even then the expansion of the last stage starts with $$k_4=f+f'fh+\left(\tfrac12f'^2f+\tfrac12f''[f,f]\right)h^2 + \left(\tfrac1{8}f'f''[f,f]+\tfrac12f''[f'f,f]+\tfrac1{6}f'''[f,f,f]\right)h^3 + ...$$ while $$y(t+h) = y+fh+\frac12f'fh^2+\frac16\Bigl(f''[f,f]+f'^2f\Bigr)h^3+\frac1{24}\Bigl(f'''[f,f,f]+3f''[f'f,f]+f'f''[f,f]+f'^3f\Bigr)h^4+O(h^5)$$ Obviously, the error term stems from the missing 4th degree resp. 5th degree term. May 16, 2019 at 10:02