The Runge-Kutta fourth order should have a local error of the form $\mathcal{O}(h^5)$. I have a simple problem where the solution is quadratic but the RK4 is not exact. I do not understand why. I expected the method to be exact in that case.
Here is the problem:
Given the initial value problem. \begin{eqnarray} x'(t) =x(t) - t^2 + 1 \quad , \quad 0 \le t \le 2 \quad , \quad x(0)=1. \end{eqnarray} find $x(2)$ in one step of RK4.
We could verify that the exact solution is given by $x(t)=(1+t)^2$ which is quadratic in $t$.
Following the RK4 algorithm we can find using the step size $h=2$,
\begin{eqnarray} k1 &=& 2 \\ k2 &=& 3.0 \\ k3 &=& 4.0 \\ k4 &=& 6.0 \\ x(2) &=& 8.333333333333332 \end{eqnarray}
The exact solution is $x(2)=(1+2)^2=9$ and the error is about $9-8.333...=0.666...$ Not exact.
Where is the problem?
Thanks.