# Finding the order of error - Confusion

I am confused because two ways of determining the order of error have been presented to me. Unless I am mistaken, the following are true:

1) The order of error can be found by finding the errors at $h$ and $\frac{h}{2}$ and then finding the ratio between the two.

2) We can use the the ratio described in $1$ and then compute: The observed-order is $\frac{\log(|ratio|)}{log|\frac{0.25}{0.125}|}$. (Or some other $h$ values differing by a factor of $2$.)

In using these I will sometimes get an order of say $O(h)$ for $1)$ and $O(h^2)$ for $2)$.

I don't understand why there are two ways to do this. Am I misunderstanding this?

Thanks.

The second statement makes more sense to me. Saying that $\text{error}=\Theta\left(h^p\right)$ means that $\text{error}(h)\rightarrow Ch^p$ as $h\rightarrow0$, so $$\ln\frac{\text{error}(h)}{\text{error}(h/r)}\rightarrow\ln\frac{Ch^p}{C(h/r)^p}=p\ln r$$ So you just divide that by $\ln r$ to extract $p$, the order of the error. This only works if error is roughly polynomial in $h$; if some other dependence were assumed rederivation would be in order.