uniform.right
uniform.right(number), function
def pure uniform.right(n: number): zedfunc
Returns the function $f: x \mapsto \bold 1 (k \geq n)$, that maps $k$ to $1$ if $k \geq n$ and $0$ otherwise.
The argument n
must be an integer or the function fails.
n
: the start of the interval that the zedfunc will map to 1
Example
show scalar "" a1b2 with uniform.right(5)
Errors
Calling uniform.right
with a non-integer argument will fail and return the following error:
‘uniform.right(n)’ is rounding fractional numbers.
Recipes and best practices
uniform.right
can be used to modify another zedfunc by setting its values to 0 before a certain point:
// This function maps positive integers to themselves and negative integers to 0
f2 = linear(1) * uniform.right(0)
show scalar "f2" a5b6 with f2
In a supply chain context, uniform.right
is used in the definition of the sell-through function when the demand distribution can reach negative values:
uncoveredDemand = negativeBinomial(5, 1) - 2
sellThrough = (1 - cdf(uncoveredDemand + 1)) * uniform.right(1)
show scalar "Uncovered demand" a5 with uncoveredDemand
show scalar "Sell-through function" c6 with sellThrough
Negative demand forecasts can occur when working with uncovered demand or net demand.