I am responsible for assisting with certain error measurements for an FE program. The idea is to set up some benchmark comparisons which we can use for future development of the program.
To simplify the task I chose to look at a simple finite difference scheme for the equation of a parabola. Consider discrete values of $x_i$ where $\mathbb{x}$ is a vector:
$$\mathbb{x} = \left< \begin{matrix} 0&1&2&3&4&5&6&7\end{matrix}\right>$$
Now consider a mapping of $\mathbb{x}\rightarrow\mathbb{f}$ where $f_i = x_i^2$. It sounds fancy when I say it like that but its really just making a new vector with each value in it equalling the value $x_i^2$. $$\mathbb{f} = \left< \begin{matrix} 0&1&4&9&16&25&36&49\end{matrix}\right>$$
Plotting $\mathbb{f} $ versus $\mathbb{x}$ yields some sort of discretized parabola. The numerical derivative of this would be
$$\mathbb{df}_{num} = \left< \begin{matrix} 1&3&5&7&9&11&13&15\end{matrix}\right>$$
Using a very simple finite difference scheme of: $$df_i = \frac{f_{i+1}-f_i}{x_{i+1}-x_i}$$
It will also be noted that $\mathbb{df}_{num}$ contains one less term than $\mathbb{f}$. This, I believe, is inherent to finite differences.
The analytical counterpart for $\mathbb{df}$ which follows from $\frac {d }{d x}x^2 = 2x$ would be
$$\mathbb{df}_{a} = \left< \begin{matrix} 0&2&4&6&8&10&12&14\end{matrix}\right>$$.
Now subtracting the 2 vectors we get $\mathbb{f}_a-\mathbb{f}_{num} = \left< \begin{matrix} -1&-1&-1&-1&-1&-1&-1&-1\end{matrix}\right>$
Which is a sort of crude error measure.
What would be a better error measure? Something that would be simple to implement for things like this but precise enough that it can spot deviations efficiently in the context of a script? The idea is to have an error vector like this and compare each value in it with some sort of threshhold value, though we have no idea what this threshhold value would be...