max

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

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

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(n : number, …) -> number, const autodiff pure function

Returns the largest of the list of numbers. The function is variadic.

show scalar "" a1 with max(1, 2)
show scalar "" b1 with max(2, 3, 4)
show scalar "" c1 with max(3, 4, 5, 6)

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(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)$. The function is variadic.

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

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