0

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).

Thomas Andrews
  • 177,126
  • Well, the formula you get for $\text{max}(a,\text{max}(b,c))$ is a formula for $\text{max}(a,b,c)$. Even without simplifying, it's a formula. So... what exactly are you asking? – Lee Mosher Dec 31 '21 at 20:34
  • There is already a function in Excel which will take the max of a group of arbitrary dimensions, so just take the maximums of each row and put that in a new column – Stephen Donovan Dec 31 '21 at 20:39
  • I can't use MAX or MIN in the spreadsheet formula. This is kind of an advanced spreadsheet formula concern, so I was hoping not to get into it since that's not really what this site is for. For the time being, just take my word for it: I can't use MAX or MIN, I need to duplicate those functions through algebra. – Blake Mutschler Dec 31 '21 at 20:47
  • For three variables: https://math.stackexchange.com/q/1219291/42969. – Martin R Dec 31 '21 at 20:56

1 Answers1

1

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.

AKP2002
  • 156
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. – Community Jan 01 '22 at 05:50
  • https://math.stackexchange.com/a/13254/42969 – Martin R Jan 01 '22 at 11:41
  • 2
    Well that is 100% the KIND of answer I was looking for! But I may need to brush myself up on limits to implement it. Thanks a million though! – Blake Mutschler Jan 04 '22 at 15:20