Convergence plot for ODEs with no exact solution

numerical linear algebranumerical methodsordinary differential equations

To analyze a numerical method for an ODE, we can create a loglog plot of the error versus the stepsize, and the slope of that curve is the order of the method. The error is is the norm of the difference between the exact and approximate solution.

Suppose the ODE does not have an exact solution, for example the Van der Pol oscillator. How do you create a convergence plot in that case. Specifically how do you compute the error without an exact solution?

Best Answer

Artem's comment is correct. Let me expand their point.

Let $u$ be the true solution. Let $x\mapsto v(x;h)$ be an approximate solution with step size $h$. Suppose the error at $x$ is polynomial in $h$: $$ v(x;h)=u(x)+ch^{p}+o(h^{p}). $$ Let $$ w(x;h)\equiv\frac{v(x;\frac{h}{1})-v(x;\frac{h}{2})}{v(x;\frac{h}{2})-v(x;\frac{h}{4})}. $$ By ordinary calculus, $$ \lim_{h\downarrow0}w(x;h)=2^{p}. $$ Assuming $h\mapsto w(x;h)$ is continuous in a (punctured) neighborhood of zero and using the fact that continuous functions and limits commute, $$ \lim_{h\downarrow0}\lg w(x;h)=p. $$ This gives you a very simple way to approximate the rate of convergence: fix $h$ and compute $\lg w(x;h)$. Note that computing $w(x;h)$ requires the approximate solution at three different step sizes ($h / 2^d$ for $d = 0, 1, 2$). Note, in particular, that $w(x;h)$ does not depend on the exact solution.