2
$\begingroup$

I've looked but cannot find the mathematical way to represent the following:

r = Max(x1, x2, x3) 

I want to mathematically show that r = max value of the set (x1, x2, x3). To make sure I'm being clear, I want to write the math formula of the code equivalent.

  • 0
    possible duplicate of [Nice expression for minimum of three variables?](http://math.stackexchange.com/questions/13253/nice-expression-for-minimum-of-three-variables)2010-12-19

2 Answers 2

3

As I responded on stackoverflow...

You can take the infinity/uniform norm of the corresponding tuple, which is defined as

$\lim_{n \rightarrow \infty} (|x_1|^n + |x_2|^n + |x_3|^n + ...)^{\frac{1}{n}}$

Or you can just have a maximum/infimum function... what exactly is your problem with using that?

Alternatively, you can define $f\mbox{ = max}$ recursively as

$f(\{a_1,a_2,a_3,\cdots\}) = \begin{cases} a_1 & \mbox{if the sequence is singleton} \\ f(\{a_2,a_3,a_4,\cdots\}) & \mbox{if } a_1 \leq a_2 \\ f(\{a_1,a_3,a_4,\cdots\}) & \mbox{otherwise} \end{cases}$

This can be made a lot nicer if you allow $f$ to be a two variable function with an accumulator.

  • 3
    Just writing 'max' is fine. Also of note is the supremum, which is the least upper bound of the sequence (this can be different from maximum if the sequence is infinite... consider the sequence {1-1/n}, which has no maximum but a least upper bound of 1).2010-12-19
1

I wouldn't write $\max(a,b)$ or $\max(a,b,c)$. For me, max assigns to a set its maximal element (if it exists), so I use $\max\{a,b\}$ and $\max\{a,b,c\}$. In general, if $A$ is a set of real numbers, I write $\max A := \sup A$ (the supremum of $A$) if $\sup A$ is an element of $A$.

  • 0
    +1 spot-on re. the {}. Thanks.2010-12-19