Skip to content

UnitTriangle ​

The unit triangle function: 1 - |x| for -1 <= x <= 1, 0 otherwise.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageUnitTriangle✓
UnitTriangle(x)max(1 - |x|, 0).
Typed signatures
TypePackageApplies
(real) -> numberanalyticalways

Domain: Elementary functions

Details
  • Continuous everywhere, including the endpoints -- UnitTriangle(±1) = 0 falls out of the formula itself, no special case needed.
  • The same function as HeavisideLambda; Wolfram keeps both names for the two contexts (elementary vs. the Heaviside/Dirac generalized-function family) it shows up in.
  • N(x, d) past a double's digits keeps the bignum operand and returns 1−∣x∣1 - |x| in its digits.

Examples

1 more kept as data, checked against the oracles
Basic #

The peak

live ↗
InUnitTriangle(0)\mathrm{UnitTriangle}(0)Out11

Zero at the endpoint

live ↗
InUnitTriangle(1)\mathrm{UnitTriangle}(1)Out00
live ↗
InUnitTriangle(−1)\mathrm{UnitTriangle}(-1)Out00

UnitTriangle as a two-branch Piecewise

live ↗
InPiecewiseExpand(UnitTriangle(x))\mathrm{PiecewiseExpand}(\mathrm{UnitTriangle}(x))OutPiecewise([[1−x,0≤x≤1],[x+1,−1≤x∧x<0]],0)\mathrm{Piecewise}(\bigl\lbrack\bigl\lbrack1-x, 0≤x≤1\bigr\rbrack, \bigl\lbrack x+1, -1≤x∧x\lt0\bigr\rbrack\bigr\rbrack, 0)
Scope #

Zero past the endpoints

live ↗
InUnitTriangle(2)\mathrm{UnitTriangle}(2)Out00

Exact rational input, exact rational output

live ↗
InUnitTriangle(13)\mathrm{UnitTriangle}(\frac{1}{3})Out23\frac{2}{3}

1−∣x∣=341-|x|=\frac34 at x=14x=\frac14

live ↗
InUnitTriangle(14)\mathrm{UnitTriangle}(\frac{1}{4})Out34\frac{3}{4}

The triangle is cut to what 0<x<20 < x < 2 leaves open

live ↗
InPiecewiseExpand(UnitTriangle(x),0<x<2)\mathrm{PiecewiseExpand}(\mathrm{UnitTriangle}(x), 0\lt x\lt2)OutPiecewise([[1−x,x≤1]],0)\mathrm{Piecewise}(\bigl\lbrack\bigl\lbrack1-x, x≤1\bigr\rbrack\bigr\rbrack, 0)
live ↗
InN(UnitTriangle(−17),50)N(\mathrm{UnitTriangle}(-\frac{1}{7}), 50)Out0.857142‾0.\overline{857142}
live ↗
InNormal⁡(Series⁡(UnitTriangle(x),x,0,3))\operatorname{Normal}(\operatorname{Series}(\mathrm{UnitTriangle}(x), x, 0, 3))Out16(UnitTriangle′′′(0)x3)+12(UnitTriangle′′(0)x2)+xUnitTriangle′(0)+1\frac{1}{6}(\mathrm{UnitTriangle}^{\prime\prime\prime}(0)x^3)+\frac{1}{2}(\mathrm{UnitTriangle}^{\prime\prime}(0)x^2)+x\mathrm{UnitTriangle}^{\prime}(0)+1
Properties #

The same function as HeavisideLambda

live ↗
InUnitTriangle(14)=HeavisideLambda(14)\mathrm{UnitTriangle}(\frac{1}{4})=\mathrm{HeavisideLambda}(\frac{1}{4})OutTrue\mathrm{True}
About
Examples12
Checked againstWolfram Language 11 agree1 unevaluated
CrosswalkWolfram Language