Sounds like a trivial question, but could not find any answer other than the fact that there are many ways to define it. My problem is this: I look at different elevation maps,


1. some with sharp mountains,
2. some rather flat, or
3. with steep but consistent slopes with little gradient variations.


For simplicity, let us assume that we are dealing with mathematical functions instead, infinitely differentiable everywhere. In order words, I am not interested here in metrics related to chaos and entropy: that would be the subject of a different question, but you are welcome to discuss it as well. In one dimension, a smoothness metric frequently cited is
$$ S(f, [a, b]) = \int\_a^b |f''(x)|^2 dx. $$


How do you generalize this in a way that makes sense for my problem? All gradients or Jacobians are discrete in my case, but ignore this for simplicity. I tested the following:


$$ S(f, D) = \int\_D \big\|\nabla\|\nabla(f(z))\|\big\| dz.$$


where $\|\cdot\|$ is $L\_2$ norm. Sounds ugly and I did not use $\|\cdot\|^2$, yet I get decent results. My guess is that metrics based on the Jacobian may make more sense. What would you suggest, and why?



What are the best definitions for smoothness of a 2D curve (real-valued function)?
$S(f,[a,b])=\int\_a^b f''(x)^2\,dx$ is, not a measure of smoothness, but rather a measure of nonlinearity (or, better, of non-affinity or, one might say, of "sharp-turn'ness") of a function $f$. Indeed, $S(f,[a,b])$ takes its smallest value $0$ if and only if $f$ is affine on $[a,b]$. (Of course, here I use the term "measure" not in a measure-theoretic sense.)


$S(f,[a,b])$ is used as the penalty term in [cubic spline regression](https://en.wikipedia.org/wiki/Smoothing_spline#Cubic_spline_definition). As even this name, "cubic spline regression", suggests, the resulting estimate of an unknown estimated function is a cubic spline -- which is of course not infinitely smooth.


The cubic spline regression is naturally and faithfully generalized to the [multidimensional case](https://en.wikipedia.org/wiki/Smoothing_spline#Multidimensional_splines), that is, for functions $f$ defined on subsets $D$ of $\mathbb R^d$ for $d\ge2$, by using a penalty term of the form
$$\int\_D \|f''(x)\|^2\,dx,$$
where (for our purposes here) $f''(x)$ is the Hessian matrix of $f$ at a point $x$ and $\|\cdot\|$ is a matrix norm. In the just linked section of the Wikipedia article, they use the Frobenius matrix norm, which is one of simplest to compute, but one can also use any other matrix norm instead.


Thus, the natural suggestion is to use $\int\_D \|f''(x)\|^2\,dx$ as a generalization of $S(f,[a,b])=\int\_a^b f''(x)^2\,dx$.


Concerning discrete settings, use naturally the discrete counterparts of the second partial derivatives, and the corresponding summation instead of the integration.


