The maximum between two numbers $x$ and $y$ can be easily written as $$ max(x,y) = \frac12\left(x+y +|x-y|\right). $$ We can obviously generalize this to any number of arguments as $$ max(x_1,\dots,x_n) = max(x_1, max(... ,max(x_{n-1},x_n)...)) = \text{ a mess with absolute values} $$ but I do not like this. I would like to have a nicely written formula and the formula should look the same if we shuffle $x_1,\dots,x_n$.

Why? You might ask? I'm doing some numerical computations where I need to smooth out the $max$ function, I just trivially smooth out the absolute value: $$ max_{\varepsilon}(x,y) = \frac12\left(x+y +|x-y|_{\varepsilon}\right) = \frac12\left(x+y +\sqrt{ (x-y)^2 + \varepsilon^2} - \varepsilon\right). $$ However, I actually need to smooth out the $max$ function for arbitrary number of arguments. The basic requirement on $max_\varepsilon(x_1,\dots, x_n)$ is that it is invariant under any permutation of its arguments. Therefore if I have $max(x_1,\dots,x_n)$ written out with absolute values and the expression is symmetrical in $x_1,\dots,x_n$ then I can just replace $|\cdot|$ with smoothed version of absolute value $|\cdot |_\varepsilon$ and I get the desired result.

Thus, is there an expression with just absolute values which is symmetrical in $x_1,\dots,x_n$ and when evaluated it yields the maximum?

  • 1
    $\begingroup$ Would you be happy with en.wikipedia.org/wiki/Smooth_maximum ? $\endgroup$ – Ru Hasha Jan 18 at 15:02
  • $\begingroup$ Cool! That should solve my problem, but I'm still curious about the question I have posted. $\endgroup$ – tom Jan 18 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.