The average distance between functions Say you have 3 functions, $f_1(x)$, $f_2(x)$, and $f_3(x)$.
The average distance between each of these functions and the other functions would be
$$\frac{(|f_1(x)\ -\ f_2(x)|\ +\ |(f_1(x)\ -\ f_3(x)|)\ +\ (|f_2(x)\ -\ (f_1(x)|\ +\ |(f_2(x)\ -\ f_3(x)|)\ +\ (|f_3(x)\ -\ f_1(x)|\ +\ |f_3(x)\ -\ f_2(x)|)}{3}$$
As you can see, even with just 3 functions, it's getting kind of long. Is there a way to simplify this, or another way to calculate it, for say 5 functions, or 50, or even infinite functions? As far as I'm aware, there's no way to distribute absolute values.
 A: Hopefully the following insight is useful for you, just an idea.
Things become maybe easier if you not simply look at all permutations of distances between the functions, but sort all function values as points on a line. Define $d_{ij}=|f_i(x)-f_j(x)|$ as the distance between 2 neighbour points. We can use each $d_{ij}$ to calculate the average distance, and we'll look how often each $d_{ij}$ is used in the calculation:

So in A we have two points and $d_{21}$ is of course $n_{21}=1$ times used in the average calculation. Proceed to B where we added point 3. This point must be combined with each of the existing points as new mutual distances, see the yellow bars. The same for C where yet another point is added. Let $\mathbf{n}=(n_{21},n_{32}, \cdots)$ be the vector with counts for all $d_{ij}$. If $N$ is the number of points, we can deduce from the illustration that if:
$$
\mathbf{n_N}=(n_{21},n_{32}, \cdots, n_{N(N-1)})
$$
then
$$
\mathbf{n_{N+1}}=(\mathbf{n_N},0)+(1,2,3,\cdots,N+1)
$$
where $(\mathbf{n_N},0)$ means that $\mathbf{n_N}$ is extended at the right side with a zero, and then the two vectors are added element-wise. The vector $\mathbf{n_N}$ looks like Pascal's triangle but is a bit different (maybe a mathematician here knows more?). For the average distance, we calculate:
$$
d_{av}=\frac{d_{21}*n_{21}+d_{32}*n_{32}+\cdots}{\sum\mathbf{n}}
$$
I think this calculation scheme is easier, because the count vector $\mathbf{n}$ can be calculated independently from the actual function values.
