A few years ago I derived the following formula which I just came across in my notes:


Has anyone seen this before, and if so is there a reference? There is also a version for $\max$,

$$\max(x,y)=\log \left(\frac{e^x+e^y}{1+e^{-\left| x-y\right| }}\right).$$

At the time (rightly or wrongly!) I thought maybe it might shed light on "$\min$" and "$\max$" analogies for complex numbers, but apart from producing a new complex number (different to $x$ and $y$) it didn't yield much. Still I'd not seen this before so thought it might be of interest... Works perfectly for the reals.


Apparently this is related to the Softmax function.


1 Answer 1


Whether it's related to softmax or not, we have $$ \log\left(\frac{1+e^{2t}}{1+e^{|2t|}}\right)= \log\left(\frac{e^t\cosh t}{e^{|t|}\cosh|t|}\right)= t-|t| $$ For $2t=x-y$, we get that your second expression for the minimum is $$ y+\frac{x-y}{2}-\frac{|x-y|}{2}=\frac{1}{2}(x+y-|x-y|) $$ which is a well known expression for $\min\{x,y\}$ and much less heavy from a computational point of view.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .