min

min, function

def nosort process min(value: _typ): _typ
def const dash autodiff pure min(a: number, b: number): number
def pure min(r: ranvar, n: number): ranvar
def pure min(n: number, r: ranvar): ranvar
def pure min(r1: ranvar, r2: ranvar): ranvar
def pure min(z: zedfunc, n: number): zedfunc
def pure min(n: number, z: zedfunc): zedfunc
def pure min(z1: zedfunc, z2: zedfunc): zedfunc

Returns the smallest value in a group, or the pointwise minimum for numbers, ranvars, or zedfuncs.

Examples

table T = with
  [| as Group, as Value |]
  [| "A", 2 |]
  [| "A", 1 |]
  [| "B", 4 |]
  [| "B", 3 |]

table G[g] = by T.Group
G.Min = min(T.Value)

show table "Minimum" with
  g as "Group"
  G.Min as "Min"

This produces the following table:

Group Min
A 1
B 3
show table "Min value" with
  min(1, 2, 3) as "Value"

This produces the following table:

Value
1
r1 = poisson(1)
r2 = poisson(3)

show table "Min ranvar" with
  mean(min(r1, r2)) as "Mean"

This produces the following table:

Mean
0.8658346

Remarks

The numeric overload is variadic. Empty groups return the default value for the data type.

User Contributed Notes
0 notes + add a note