Previous Up Next

21.1.2  Rectangle function

The rectangle function Π is 0 everywhere except on [−1/2,1/2], where it is 1; namely, Π(x)=θ(x+1/2)−θ(x−1/2) where θ is the Heaviside function. The rectangle function is a special case of boxcar function (see Section 21.1.1) for a=−1/2 and b=1/2.

The rect command computes the rectangle function.

Example

rect(x/2)
     
θ


x
2
+
1
2



θ


x
2
1
2



          

To compute the convolution of the rectangle function with itself, you can use the Convolution Theorem (see Section 21.4.2).

R:=fourier(rect(x),x,s):; ifourier(R^2,s,x)
     
−2 x θ
x
+x θ
x+1
+x θ
x−1
+θ
x+1
θ
x−1
          

This result is the triangle function tri(x) (see section 21.1.3).


Previous Up Next