# Boxcar function: boxcar

### 15.2.1 Boxcar function: boxcar

The boxcar command creates a function which is 0 everywhere except in a given interval, where it is 1.

- boxcar takes three arguments:
  - a,b, two real numbers.
  - x, an identifier or expression.
- boxcar(a,b,x) returns θ(x−a)−θ(x−b), where θ is the Heaviside function (see Section 5.8.9). The resulting expression defines a function which is zero everywhere except within the segment [a,b], where its value is equal to 1.

#### Examples.

- Input:
  boxcar(1,2,x)
  Output:

  θ | ⎛ ⎝ | x−1 | ⎞ ⎠ | −θ | ⎛ ⎝ | x−2 | ⎞ ⎠

- Input:
  boxcar(1,2,3/2)
  Output:

  1

- Input:
  boxcar(1,2,0)
  Output:

  0