Solve equations using the $\max$ function

How do you address formulas that entail the $\max$ function? As an example:. $$\max(8-x, 0) + \max(272-x, 0) + \max(-100-x, 0) = 180$$

In this instance, I can exercise in my head that $x = 92.$ But what is the basic procedure to make use of when the variety of $\max$ terms are approximate? Many thanks for the aid, below is a Python remedy for the trouble if any person 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)
3
2022-07-25 20:42:42
Source Share
Answers: 0