SquareWave
The square wave: period 1, default range {-1, 1}, value 1 on [0, 1/2) and -1 on [1/2, 1) of each period.
✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram Language
SquareWave✓SquareWave(x)1 for x - floor(x) in [0, 1/2), -1 for x - floor(x) in [1/2, 1).SquareWave({min, max}, x)the square wave rescaled to vary between min and max, unit period.Typed signatures
| Type | Package | Applies |
|---|---|---|
(real | vector<real^2>, real?) -> number | analytic | always |
Details
- SquareWave(0) = 1 -- the half-open convention puts the period's left edge in the high half.
- Default range is {-1, 1}, not {0, 1} -- SquareWave(1/2) = -1.
- The range form takes the range FIRST, x second -- SquareWave({min, max}, x) -- matching SawtoothWave and TriangleWave.
Examples
Scope #
The branch decision is certified numerically even though the output is a plain constant
live ↗InOut
Known value · f = Frac(-π) = 4 - π > 1/2, so the second half
About
| Examples | 7 |
|---|---|
| Checked against | Wolfram Language 7 agree |
| Crosswalk | Wolfram Language |