Square pulse function?



On 2008-05-29 20:20:00 +0100, Alexey Beshenov <al at beshenov.ru> said:
> matchdeclare (t,true,[a,b], lambda([x],constantp(x) and imagpart(x)=3D0))$
> 
> spint (a,b) :=3D (
>     if a > b then
>         -spint(b,a)
>     else (
>         if a < -1/2 then a : -1/2,
>         if b > 1/2 then b : 1/2,
>         b-a
>     )
> )$
> 
> tellsimp(square_pulse(t), (if t<-1/2 or t > 1/2 then 0 else 1))$
> tellsimp('integrate(square_pulse(t),t,a,b), spint(a,b))$
> 
>   integrate(square_pulse(t),t,-1/5,4) =3D> 7/10

Is this the usual way to introduce new special functions to Maxima -- 
tell the simplifier how to reduce them to other forms? I guess the same 
thing would work with diff?

Thanks,
Paul