Skip to content

TriangleWave ​

The triangle wave: period 1, default range {-1, 1}, sine-like phase (0 at x = 0, peak at x = 1/4).

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageTriangleWave✓
TriangleWave(x)a triangular approximation to sin(2Pix) -- 0 at x = 0, 1 at x = 1/4, 0 at x = 1/2, -1 at x = 3/4.
TriangleWave({min, max}, x)the triangle wave rescaled to vary from min to max, unit period.
Typed signatures
TypePackageApplies
(real | vector<real^2>, real?) -> numberanalyticalways

Domain: Elementary functions

Details
  • Default range is {-1, 1} with a sine-like phase, NOT the [0, 1] tent UnitTriangle/HeavisideLambda use -- TriangleWave(0) = 0, not 1.
  • Continuous everywhere, including at the peak and trough.
  • The range form takes the range FIRST, x second -- TriangleWave({min, max}, x) -- matching SawtoothWave and SquareWave.

Examples

Basic #

Zero-crossing at x = 0, unlike UnitTriangle's peak there

live ↗
InTriangleWave(0)\mathrm{TriangleWave}(0)Out00

The peak, at the quarter period

live ↗
InTriangleWave(14)\mathrm{TriangleWave}(\frac{1}{4})Out11

Zero-crossing again at the half period

live ↗
InTriangleWave(12)\mathrm{TriangleWave}(\frac{1}{2})Out00

The trough, at the three-quarter period

live ↗
InTriangleWave(34)\mathrm{TriangleWave}(\frac{3}{4})Out−1-1
Scope #

Rescaled to a {min, max} range -- the range's midpoint at the half period

live ↗
InTriangleWave([0,10],12)\mathrm{TriangleWave}(\bigl\lbrack0, 10\bigr\rbrack, \frac{1}{2})Out55

An exact irrational input stays exact through the affine branch

live ↗
InTriangleWave(−π)\mathrm{TriangleWave}(-π)Out12−4π12-4π

Known value · f = Frac(-π) = 4 - π ∈ (3/4, 1), so TriangleWave = 4f - 4

Properties #

Period 1

live ↗
InTriangleWave(14)=TriangleWave(314)\mathrm{TriangleWave}(\frac{1}{4})=\mathrm{TriangleWave}(3\frac{1}{4})OutTrue\mathrm{True}
About
Examples7
Checked againstWolfram Language 7 agree
CrosswalkWolfram Language