How can I compare/quantify the difference in a numerical solution to a analytical one?

Say I have two functions f(x) and g(x). f(x) is a numerical approximation of g(x), which itself is a analytical solution.

 

g(x) is defined for -inf to +inf.

However I am looking at a defined parameter space of -a to +a.

 

My question is this: What is the appropriate way to quantify the differences i.e. to say how different the two functions are to one another?

Posted Mar 8, 2019, 10:14 AM UTC

34
PannacottaArmy•

You can treat the functions as elements of an L^p space (https://en.wikipedia.org/wiki/Lp_space) and use the norm of the difference between the two functions. If you choose p=2 then the distance between f and g is the square root of the integral of |f(x) - g(x)|^2 dx from -a to a, which you can estimate numerically.

edit: fixed a typo.

2
abmaurer•

You just described the L1 norm, not the L2 norm.

1
PannacottaArmy•

Thanks! Although I don't think it's technically either since the L1 and L2 norms are defined on finite-dimensional vector spaces. But I take your point, since it's the generalisation of those norms.

1
abmaurer•

The Lp norm is a norm defined on the set of measurable functions which satisfy |f|^(p) is integrable, which is typically infinite-dimensional*. The question is: measurable functions on what space.

If you choose [n] = {1,2,...,n} with the discrete sigma algebra and measure given by m(A) = |A|/n, then L^(p)([n]) will be a finite dimensional vector space with the norm you defined (once you have an appropriate notion of integral). However if you choose the real numbers RR, then L^(p)(RR) will have uncountable dimension, with norm defined as you said.

​

* OK actually on equivalence classes of functions which differ on a set of measure zero.

1