SawtoothWave
The sawtooth wave: x - floor(x), period 1, range [0, 1).
✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram Language
SawtoothWave!SawtoothWave(x)x - floor(x), unit period, range [0, 1).SawtoothWave({min, max}, x)the sawtooth rescaled to vary from min to max, unit period.Typed signatures
| Type | Package | Applies |
|---|---|---|
(real | vector<real^2>, real?) -> number | analytic | always |
Details
- Unlike FractionalPart, which keeps the sign of x, SawtoothWave(x) is always in [0, 1) -- SawtoothWave(-1/4) is 3/4, not -1/4.
- The range form takes the range FIRST, x second -- SawtoothWave({min, max}, x) -- matching Wolfram's own argument order for this family.
Examples
Scope #
An exact irrational input: the branch is decided numerically, but the result stays exact
live ↗InOut
Known value · Frac(x) = x - Floor(x); Floor(-π) = -4, so Frac(-π) = 4 - π
A huge exact argument stays unevaluated: a double can't resolve 10^20·π's fractional part to certify a branch, so this declines rather than risk a wrong one
live ↗InOut
About
| Examples | 7 |
|---|---|
| Checked against | Wolfram Language 6 agree1 differ |
| Crosswalk | Wolfram Language |