0
$\begingroup$

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

$\endgroup$
4
  • $\begingroup$ 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? $\endgroup$
    – Lee Mosher
    Dec 31, 2021 at 20:34
  • $\begingroup$ 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 $\endgroup$ Dec 31, 2021 at 20:39
  • $\begingroup$ 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. $\endgroup$ Dec 31, 2021 at 20:47
  • $\begingroup$ For three variables: math.stackexchange.com/q/1219291/42969. $\endgroup$
    – Martin R
    Dec 31, 2021 at 20:56

1 Answer 1

1
$\begingroup$

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.

$\endgroup$
3
  • $\begingroup$ 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. $\endgroup$
    – Community Bot
    Jan 1, 2022 at 5:50
  • $\begingroup$ math.stackexchange.com/a/13254/42969 $\endgroup$
    – Martin R
    Jan 1, 2022 at 11:41
  • 2
    $\begingroup$ 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! $\endgroup$ Jan 4, 2022 at 15:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .