kigubkur.elfun.heaviside
Elementary Function: Heaviside functions.
ustep
heavix
(require '[kigubkur.elfun [heaviside :refer [ustep heavix]]])
Examples
Unit Step function
=> (ustep -5)
0
=> (ustep [[-2 -1 0 1 2]])
[[0 0 1 1 1]]
=> (ustep [[-2.5] [-1.5] [0] [1.5] [2.5]])
[[0] [0] [1] [1] [1]]
=> (ustep [[3 -2][0 1]])
[[1 0] [1 1]]
Heaviside extractor
=> (heavix -5)
0
=> (heavix [[-2 -1 0 1 2]])
[[0 0 0 1 2]]
=> (heavix [[-2.5] [-1.5] [0] [1.5] [2.5]])
[[0] [0] [0] [1.5] [2.5]]
=> (heavix [[3 -2][0 1]])
[[3 0] [0 1]]
heavix
(heavix X)
Returns the Heaviside extractor function value of a number or every element of a matrix or a block (i.e. element-wise step); Heaviside extractor function of x defined as
x | [x]+ ≝ |
---|---|
>0 | x |
≤0 | 0 |
Syntax: (heavix X)
s.t X
is a scalar or a kigubkur© matrix (or both blocks)
Note: if x ∈ {##NaN
, ##Inf
, ##-Inf
}, returns ##NaN
.
ustep
(ustep x)
Returns the Heaviside unit step function value of a number or every element of a matrix or a block (i.e. element-wise step); unit step function of x defined as
x | ℱ(x) ≝ |
---|---|
≥0 | +1 |
<0 | 0 |
Note: if x ∈ {##NaN
, ##Inf
, ##-Inf
}, returns ##NaN
.