uniform.left

uniform.left(number), function

def pure uniform.left(n: number): zedfunc

Returns the function $f: x \mapsto \bold{1}(k \leq n)$, that maps $k$ to $1$ if $k \leq n$ and $0$ otherwise.
The argument n must be an integer or the function fails.

Example

show scalar "" a1b2 with uniform.left(5)

Errors

Calling uniform.left with a non-integer argument will fail and return the following error:

‘uniform.left(n)’ is rounding fractional numbers.

Recipes and best practices

uniform.left can be used to modify another zedfunc by setting its values to 0 after a certain point:

// This function maps negative integers to themselves and positive integers to 0
f2 = linear(1) * uniform.left(0)
show scalar "f2" a5b6 with f2

See also

User Contributed Notes
0 notes + add a note