Skip to content

UnitBox ​

The unit box function: 1 on the closed [-1/2, 1/2], 0 outside.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageUnitBox✓
UnitBox(x)1 for -1/2 <= x <= 1/2, 0 otherwise.
UnitBox(x1, x2, …)the product of the unit boxes -- 0 as soon as any argument is outside its own [-1/2, 1/2].
Typed signatures
TypePackageApplies
(real, real*) -> numberanalyticalways

Domain: Elementary functions

Details
  • Defined everywhere, including the boundary -- unlike HeavisidePi, the same rectangular pulse shape but left unevaluated at x = ±1/2 instead of closed there. UnitBox and HeavisidePi differ exactly at the boundary.
  • D(UnitBox(x), x) = Piecewise({{Indeterminate, x == 1/2 || x == -1/2}}, 0) -- 0 away from the jump, undefined exactly at the two points where UnitBox is discontinuous.

Examples

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

Inside the box

live ↗
InUnitBox(0)\mathrm{UnitBox}(0)Out11

The boundary is closed

live ↗
InUnitBox(12)\mathrm{UnitBox}(\frac{1}{2})Out11

The boundary is closed

live ↗
InUnitBox(−12)\mathrm{UnitBox}(-\frac{1}{2})Out11

UnitBox as a one-branch Piecewise

live ↗
InPiecewiseExpand(UnitBox(x))\mathrm{PiecewiseExpand}(\mathrm{UnitBox}(x))OutPiecewise([[1,−1/2≤x≤1/2]],0)\mathrm{Piecewise}(\bigl\lbrack\bigl\lbrack1, -1/2≤x≤1/2\bigr\rbrack\bigr\rbrack, 0)
Scope #

Outside the box

live ↗
InUnitBox(1)\mathrm{UnitBox}(1)Out00

Two arguments -- the product of their unit boxes

live ↗
InUnitBox(0,0)\mathrm{UnitBox}(0, 0)Out11

An exact irrational operand: the boundary decision is certified, not a premature float

live ↗
InUnitBox(π4)\mathrm{UnitBox}(\frac{π}{4})Out00

Known value · π/4 > 1/2

An exact irrational operand inside the box

live ↗
InUnitBox(24)\mathrm{UnitBox}(\frac{\sqrt{2}}{4})Out11

Known value · √2/4 ≈ 0.354 < 1/2

Zero outside the support

live ↗
InUnitBox(−1)\mathrm{UnitBox}(-1)Out00

One inside ∣x∣<12|x|<\frac12

live ↗
InUnitBox(14)\mathrm{UnitBox}(\frac{1}{4})Out11

A matrix function with eigenvalues 12\frac12 and 13\frac13, giving the identity

live ↗
InFullSimplify(MatrixFunction(UnitBox,[[1/2,−1],[0,1/3]]))\mathrm{FullSimplify}(\mathrm{MatrixFunction}(\mathrm{UnitBox}, \bigl\lbrack\bigl\lbrack1/2, -1\bigr\rbrack, \bigl\lbrack0, 1/3\bigr\rbrack\bigr\rbrack))Out[[1,0],[0,1]]\bigl\lbrack\bigl\lbrack1, 0\bigr\rbrack, \bigl\lbrack0, 1\bigr\rbrack\bigr\rbrack

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

live ↗
InPiecewiseExpand(UnitBox(x),0<x<2)\mathrm{PiecewiseExpand}(\mathrm{UnitBox}(x), 0\lt x\lt2)OutPiecewise([[1,x≤1/2]],0)\mathrm{Piecewise}(\bigl\lbrack\bigl\lbrack1, x≤1/2\bigr\rbrack\bigr\rbrack, 0)
live ↗
InSame(UnitBox′′(x),UnitBox′′′(x))\mathrm{Same}(\mathrm{UnitBox}^{\prime\prime}(x), \mathrm{UnitBox}^{\prime\prime\prime}(x))OutTrue\mathrm{True}

UnitBox is locally constant, so every derivative order is the same function

live ↗
InUnitBox′′′(x)\mathrm{UnitBox}^{\prime\prime\prime}(x)OutPiecewise([[Indeterminate⁡,x=1/2∨x=−1/2]],0)\mathrm{Piecewise}(\bigl\lbrack\bigl\lbrack\operatorname{Indeterminate}, x=1/2∨x=-1/2\bigr\rbrack\bigr\rbrack, 0)
Properties #

0 away from the jump, undefined exactly at the boundary

live ↗
IndUnitBox(x)dx\frac{\mathrm{d}\mathrm{UnitBox}(x)}{\mathrm{d}x}OutPiecewise([[Indeterminate⁡,x=1/2∨x=−1/2]],0)\mathrm{Piecewise}(\bigl\lbrack\bigl\lbrack\operatorname{Indeterminate}, x=1/2∨x=-1/2\bigr\rbrack\bigr\rbrack, 0)

Zero outside the box at 2

live ↗
InUnitBox(2)\mathrm{UnitBox}(2)Out00

Known value · Wolfram MathematicalFunctionData, UnitBox

About
Examples17
Checked againstWolfram Language 17 agree
CrosswalkWolfram Language