staircase.Stairs.sample¶
-
Stairs.
sample
(x, how='right')¶ Evaluates the value of the step function at one, or more, points.
Technically the results of this function should be considered as \(\lim_{x \to z^{-}} f(x)\) or \(\lim_{x \to z^{+}} f(x)\), when how = ‘left’ or how = ‘right’ respectively. See A note on interval endpoints for an explanation.
The function should be called using parentheses. See example below.
Parameters: - x (int, float or vector data) – values at which to evaluate the function
- how ({'left', 'right'}, default 'right') – if points where step changes occur do not coincide with x then this parameter has no effect. Where a step changes occurs at a point given by x, this parameter determines if the step function is evaluated at the interval to the left, or the right.
Returns: Return type: float, or list of floats
See also
Examples
>>> s1.plot() >>> s1(3.5) 1 >>> s1([1, 2, 4.5, 6]) [1, 0, -1, 0] >>> s1([1, 2, 4.5, 6], how='left') [0, 1, -1, 0]