Previous Up Next

5.27.3  Triangle function : tri

The tri command takes an expression x as its only argument and returns the value of triangle function at x , defined by

Λ(x)=


1−|x|,|x|<1,
0,otherwise.

The above expression is equal to the convolution of rectangle function with itself (see Section 5.27.2).

For example, input :

tri(x-1)

Output :

x*(Heaviside(-x+1)-Heaviside(-x))+ (Heaviside(x-1)-Heaviside(x-2))*(-x+2)

Previous Up Next