1
$\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.

$\endgroup$
2

2 Answers 2

3
$\begingroup$

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.

$\endgroup$
3
  • 3
    $\begingroup$ Yeah, the max function is perfectly legitimate. One can also use: $\max(a,b)=\frac{1}{2}(a+b+|a-b|)$. $\endgroup$ Dec 19, 2010 at 13:32
  • $\begingroup$ I have no issue with the function. I just want to know how to write it correctly as a math formula. Average, sum, etc. is easy. But how do we say max? Do we write the word "max"? $\endgroup$
    – IamIC
    Dec 19, 2010 at 13:34
  • 3
    $\begingroup$ 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). $\endgroup$
    – Yonatan N
    Dec 19, 2010 at 13:39
1
$\begingroup$

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

$\endgroup$
0

You must log in to answer this question.

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