How can I find the observed (practical) order of convergence of a quadrature?
I remember the formula $\frac{|x_{n+1}-x_{n}|}{|x_{n}-x_{n-1}|^q}$ but does this work here aswell? This formula gives me the rate of convergence for root findings methods.
Ex: $f(x)=\sqrt{x}$. What is the observed order of convergence for this function using quadrature rules?
If you downvote, please write a comment on why you did. In this way I can improve till next time.
Yes, you can.
Let $h_0>0$ and compute approximations $A_h$ for the integral in questions for $h = 2^j h_0$, $j=0,1,2,\dots$. Here $A_h$ represents your favorite quadrature rule, say, the trapezoidal rule. Then form Richardson's fractions
$$ F_h = \frac{A_{2h} - A_{4h}}{A_h -A_{2h}}$$
You will find that the numbers
$$ \dotsc, F_{16h}, F_{8h}, F_{4h}, F_{2h}, F_h $$
in that order will tend (monotonically) towards $2^p$ where $p$ is the order of the method, provided that the integrand is sufficiently differentiable across the entire interval in question.
If you are deploying the trapezoidal rule and the function is smooth, then you will find $p=2$ as your fractions will tend to $4$. The function $f(x) = \sqrt{x}$ is a great example. Integrate it on the domain well away from $x=0$, say, $I=[0,1]$ and you will recover $p=2$. Include the point $0$, and your fractions will tend to $2^\frac{3}{2}$.
If you have MATLAB available, then there are functions which you can download here http://www8.cs.umu.se/kurser/5DV005/HT15/Programs/TOPICS/INT/ which can be of use to you. There is absolutely no warranty for these codes, so use them at your own risk. You will want to adjust the minimal working example of rode.m which computes Richardson's fractions and his error estimates in the context of numerical integration.
Be advised that the computed values Richardson's fraction suffer from subtractive cancellation, so do not pick $h_0$ too small.