How to measure monotonicity of a list of values I need to compare monotonicity of lists of values.
I have $S=(n_1,n_2,...n_n)$, I need a function $\mathrm f(S)$ to return the monotonicity of the S.
$S_1=[1,2,4,4,8]$
$S_2=[8,4,4,2,1]$
$S_3=[2,1,4,4,8]$
$S_4=[1,4,8,2,4]$
Requirement:
$f(S_1) = f(S_2) > f(S_3) > f(S_4)$
Update Question
$S_5 = [1,4,1,8]$
$S_6 = [1,4,2,8]$
$S_7 = [1,4,4,8]$
$S_8 = [1,4,6,8]$
$S_5 < S_6 < S_7 < S_8$
 A: How about 
$$ -\sum_{i=1}^{n-1} \frac{\lvert n_i-n_{i+1} \rvert}{\max(\lvert n_i \rvert, \lvert n_{i+1} \rvert) } $$
That is: summing relative gaps.
(Considering $0/0$ to be 0.)
A: I feel that what you mean with monotonicity is how much do the jump vary in size in your sequence. The following definition yields the ordering you requested in your examples:
$$
m(S) = \frac{1}{1 + \left|\mathrm{std}\left\{ (S_{i+1}-S_{i}) \right\}_i\right|}
$$
This is 0 if the sequence jumps between infinities, and 1 if the jumps are all equal (which will also be the case if the sequence is constant).
In case you're wondering about ordering them by step-size as well (ie [0 10 20 30] > [1 2 3 4]), I wouldn't include that in the formula if I were you. I prefer compact, simple formula that tell you something precise, rather than composite that can potentially be difficult to interpret. 
Here are two ways to deal with that:


*

*Order the sequence that have equal monotonicity by the average absolute jump size (procedural approach);

*Replace $\left|\mathrm{std}\left\{ (S_{i+1}-S_{i}) \right\}_i\right|$ by
$
\frac{\left|\mathrm{std}\left\{ (S_{i+1}-S_{i}) \right\}_i\right|}{1+\left|S_n-S_1\right|/n}
$ (composite approach)

A: Do you have requirement about the complexity of computation of such an index ? 
I could suggest:
Let's start with the follow special case : your list is a permutation of $S_n$, seen as a injective list of elements $\{1,2,\ldots,n\}$. You can count "inversions" ($i$ such that $\sigma (i) > i$) and symmetrize the measure for example $|inversions(\sigma) - \frac{n}{2}|$, such that 0 inversions (increasing list) and $n$ inversions (decreasing list) is maximal, and minimal index is for $\frac{n}{2}$ inversions. 
To go back to your general problem (arbitrary list), you could transform your list to a permutation by the following way : sort the list's support and then relabel elements 1,2,...
With your examples : $(1 \rightarrow 1, 2 \rightarrow 2, 4 \rightarrow 3, 4 \rightarrow 4,8 \rightarrow 5)$. 
With this relabeling, $S_1$ is $[1,2,3,4,5]$ id est identity, it has 0 inversions so its index is $|0-2.5|=2.5$ 
$S_2$ is $[5,4,3,2,1]$ has 5 inversions so its index is also $|5-2.5|=2.5$
$S_3$ is $[2,1,3,4,5]$ has 1 inversion so its index is $|1-2.5|=1.5$
$S_4$ is $[1,3,5,2,4]$ has 2 inversions so its index is $|2-2.5|=0.5$ and is maximal.
The dominating cost here comes from the sort (everything else is linear), so computing the index is globally $O(nlog(n))$. The bad point is that for elements that occur multiple times there is a choice to be made (as I did implicitly with 4,4 here - which 4 should I map to 3, and which one to 4 ?) but with a little workout, like choosing the combination such that it maximize the final index, maybe you could adapt it.
