max

max(T.A : ‘a) 🡒 ‘a, aggregator

Returns the maximal value for the group according ot the canonical ordering for the data type. All the ordered data types are supported.

Example:

table T = with
  [| as A, as B, as C |]
  [| "b", 2, date(2020, 1, 8)  |]
  [| "c", 1, date(2010, 9, 1)  |]
  [| "a", 0, date(2019, 12, 1) |]

show summary "" a1b4 with
  max(T.A)
  max(dirac(T.B))
  max(T.C)

On empty groups, the default value for the data type is returned.

max(r : ranvar, n : number) -> ranvar, pure function

Same as max(r, dirac(n)), see below. The number n must be an integer or the function fails.

max(n : number, r : ranvar) -> ranvar, pure function

Same as max(dirac(n), r), see below. The number n must be an integer or the function fails.

max(variadic r : ranvar) -> ranvar, pure function

If $X_1$ and $X_2$ are two independent random variables over $\mathbb{Z}$ represeented by the ranvars r1 and r2 respectively, returns $\max(X_1, X_2)$.

Example:

a = poisson(1)
b = poisson(2)
show scalar "a" a1c3 with a
show scalar "b" a4c6 with b
show scalar "max(a, b)" a7c9 with max(a, b)
show scalar "max(a, b, b)" a10c12 with max(a, a, b)

Beware, when ranvars are involved, max(r1, r2) is not identical to max(r1, r2, r2).

max(z : zedfunc, n : number) -> zedfunc, pure function

Same as max(z, constant(n)), see below. The number n must be an integer or the function fails.

max(n : number, z : zedfunc) -> zedfunc, pure function

Same as max(constant(n), z), see below. The number n must be an integer or the function fails.

max(variadic z : zedfunc) -> zedfunc, pure function

If $f$ and $g$ are two functions $\mathbb{Z} \to \mathbb{R}$ represented by the zedfuncs z1 and z2 respective, returns $x \mapsto f(x) + g(x)$.

Example:

a = constant(0)s
b = constant(10) - linear(1) * linear(1)
show scalar "a" a1c3 with a
show scalar "b" a4c6 with b
show scalar "max(a, b)" a7c9 with max(a, b)
show scalar "max(a, b, b)" a10c12 with max(a, a, b)

See also