Triangle Function

Author

Eric W. Weisstein
March 26, 2010

This notebook downloaded from http://mathworld.wolfram.com/notebooks/GeneralizedFunctions/TriangleFunction.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/TriangleFunction.html.

©2010 Wolfram Research, Inc. except for portions noted otherwise

Initialization

Lambda[x_]:=1-Abs[x]/;Abs[x]<1
Lambda[x_]:=0/;Abs[x]≥1

Plot

Plot[Lambda[x],{x,-2,2},
PlotStyle->Red,
AxesLabel->TraditionalForm/@{x,Λ[x]}
]

V7

Plot[UnitTriangle[x],{x,-1.2,1.2},PlotStyle->{Red,Thickness[.004]},Method->{"AxesInFront"->False}]

Plot[HeavisideLambda[x],{x,-1.2,1.2},PlotStyle->{Red,Thickness[.004]},Method->{"AxesInFront"->False}]

Special Values

V7

UnitTriangle/@{-1,0,1}

HeavisideLambda/@{-1,0,1}

FullSimplify[HeavisideLambda[x]-UnitTriangle[x]]

PiecewiseExpand[HeavisideLambda[x]]

PiecewiseExpand[UnitTriangle[x]]

FullSimplify[Piecewise[{{x+1, -1 ≤x<0},{1-x, 0≤x≤1}}]-UnitTriangle[x]]

Convolution

Λ(x)=Π (x)⋆Π(x)

V6

RectangleFunction[x_]:=(Sign[x+1/2]-Sign[x-1/2])/2

f=Integrate[RectangleFunction[t]RectangleFunction[x-t],{t,-∞,∞}]

FullSimplify[f,x∈Reals]

Plot[f,{x,-2,2},PlotStyle->Red,PlotRange->All]

V7

Convolve[HeavisidePi[x],HeavisidePi[x],x,t]

Convolve[UnitBox[x],UnitBox[x],x,t]

Λ(x)=Π(x)⋆H(x+(1/2))-Π(x)⋆H(x-(1/2))

V6

f=Integrate[RectangleFunction[t]UnitStep[x+1/2-t]-RectangleFunction[t]UnitStep[x-1/2-t],{t,-∞,∞}]

FullSimplify[f]

Plot[f,{x,-2,2},PlotStyle->Red,PlotRange->All]

V7

f=Convolve[UnitBox[x],UnitStep[x+1/2],x,t]-Convolve[UnitBox[x],UnitStep[x-1/2],x,t]//InputForm

FullSimplify[%]

Plot[f,{t,-2,2}]

f=Convolve[UnitBox[x],UnitStep[x+1/2]-UnitStep[x-1/2],x,t]//InputForm

FullSimplify[%]

Plot[f,{t,-2,2}]

Three-Argument

<<ImplicitPlot3D`

lambda[x_,y_,z_]:=x^2+y^2+z^2-2(x y+x z+y z)

With[{m=.5},ImplicitPlot3D[lambda[x,y,z],{x,-m,m},{y,-m,m},{z,-m,m},AxesLabel->TraditionalForm/@{x,y,z},Axes->True]]

LiveGraphics3D

<<Utilities`LiveGraphics3D`

WriteLiveForm["lambda.m",
With[{m=.5},
ImplicitPlot3D[lambda[x,y,z],{x,-m,m},{y,-m,m},{z,-m,m},AxesLabel->{x,y,z},Axes->True]
]
]//Timing

Solve[x^2+y^2+z^2-2(x y+x z+y z)==0,z]

ParametricPlot3D[{{x,y,x-2 (Sqrt[x]) (Sqrt[y])+y},{x,y,x+2 (Sqrt[x]) (Sqrt[y])+y}},{x,-1,1},{y,-1,1},PlotRange->Table[{-1,1},{3}]]