A funciton that finds the maximum between two values?

154 Views Asked by At

Is there an $f$ that takes two values $a$ and $b$ and if $b>a$, it returns $f(a,b) = b-a$ otherwise $f(a,b) = 0$?

Is the $f$ linear?

P.S: I think one can find the maximum between $a$ and $b$ and then subtract $a$ from the maximum to get the desired $f$ described above.

1

There are 1 best solutions below

3
On

The following is "almost" linear $$ \max\{a,b\}=\frac{a+b+|a-b|}{2} $$