Is there a known equation for max or min of a set?

141 Views Asked by At

I know that $\max(a,b) = \frac{a + b + |a-b|}2$ What I want is to formulate a similar equation generalizing larger sets: $max(a,b,c)$, $\max(a,b,c,d)$ etc. I tried doing the algebra for $\max(a,max(b,c))$ to see if a pattern would emerge but I'm having trouble simplifying.

I don't have a great understanding of algebraic transformations over absolute values. What I'm really hoping for is that there is already a known generalization for max or min of a set. Is there such an equation?

For context, this isn't academic. I'm trying to write a formula for a spreadsheet that will find me the max or min of each row of a matrix of unknown dimensions. It's not good enough to just copy a formula for each row. In Google Sheets/Excel you can do this using the function: ARRAYFORMULA which repeats a formula inside it over each member of an array, but only for scalar functions (IE I can't use the built in MAX and MIN functions in sheets). So for example, on a 2-column matrix of any length my formula is: ARRAYFORMULA((A:A+B:B±abs(A:A-B:B))/2).

1

There are 1 best solutions below

3
On

For $i$ variables $x_{1},x_{2}, \cdots ,x_{i} $ $$ \max(x_{1},x_{2}, \cdots ,x_{n})=\lim_{n \to \infty} {\left( {x_{1}}^{n}+ {x_{2}}^{n}+ \cdots + {x_{n}}^{n} \right)}^{\frac{1}{n}} $$ Is true and can easily be proved so.