# Calculating convergence order of numerical scheme for PDE

In my notes I have the following definition

If a numerical solution converges to the solution of PDE, then the order of convergence is $$R = \frac{\log_2 \| \frac{e_{new}}{e_{old}}\|}{\log_2 \| \frac{\Delta x_{new}}{\Delta x_{old}} \|}$$

I'm trying to understand the notation of this formula. What do they mean by $$e_{new},\Delta x_{new},$$ etc ? Take for example $$v_t+v_x=0$$ and suppose we approximate solution with any scheme, for example Crank-Nicolson or leapfrog. How can I compute $$R$$?

This formula assumes that for the major part, $$e=C\,(Δx)^R.$$ Then one can use the result for two different step sizes to eliminate $$C$$.

Note that the difference $$e$$ to the solution is a difference of functions, comparing the exact solution, which is a function, against the implied interpolated function of the discretized solution. This is easiest done within a finite-element framework. In the most simple example you get piecewise linear functions.

Then $$\|e\|$$ is a function norm. If you reduce it to the samples of the numerical solution and the corresponding samples of the exact solution, you need to compute the norm via a suitable discretization of the function space norm. In the easiest case of the supremums norm you get the maximum norm of the vector without additional factors, in the $$L^p$$ norms you need to replace the integral with Riemann sums.

With all this then compute

$$R=\frac{\log\|e_{\rm new}\|-\log\|e_{\rm old}\|}{\log\|Δx_{\rm new}\|-\log\|Δx_{\rm old}\|}$$

• This seems complicated to do by hand, how can we do it in matlab for certaim scheme ? – Mikey Spivak Feb 10 at 23:30
• Im just trying to understand how we can use the formula in an specific example. – Mikey Spivak Feb 11 at 23:35
• OK, I see now, say for example we are finding the convergence order of some scheme to advection using $200$ mesh points. So I can take say $\Delta x_{old} = (x_max - x_min)/200$ say and $\Delta x_{new} = (x_max - x_min ) / 100$ say... I think in matlab there is function for norm: norm(x, 2,3,...,inf). Is there any advice into how to compare them? say you want to test the convergence order if we use $N=200$. how to choose to what $dx$ to compare it with? – James Feb 15 at 22:41
• @Harry49, I am trying to calculate it on matlab, but e_new, e_old are vectors. I understand e_new = exact - scheme. I am having trouble seeing what they mean by $e_{new}, e_{old}$, do they mean the norm of the exact minus the approximation? one we have this ratio of norms then do the norm again. IS this what they mean? – James Feb 16 at 6:20
• The formula is indeed somewhat unfortunate. It should be the quotient of the norms, there is no way to divide vectors, even more so (or is that less so) vectors of different dimension. The norm needs to be a discretization of a function space norm, that is, you need suitable factors depending on $Δx$ if you take anything but the max norm. – LutzL Feb 16 at 8:18