Solve equations using the $\max$ function How do you solve equations that involve the $\max$ function? For example:
$$\max(8-x, 0) + \max(272-x, 0) + \max(-100-x, 0) = 180$$
In this case, I can work out in my head that $x = 92.$ But what is the general procedure to use when the number of $\max$ terms are arbitrary? Thanks for the help, here is a Python solution for the problem if anyone is interested.
def solve_max(y, a):
    y = sorted(y)
    for idx, y1 in enumerate(y):
        y_left = y[idx:]
        y_sum = sum(y_left)
        x = (y_sum - a) / len(y_left)
        if x <= y1:
            return x
print solve_max([8, 272, -100], 180)


Hint: You can think of $max(8-x,0)$ as a piecewise defined function. 
$$
max(8-x,0) = \begin{cases} 0 \text{ if $ x\geq 8$} &\\ 8-x \text{ if $x \lt 8$} \end{cases}
$$ Apply this idea to other $max$ functions as well.
