In Maxima, conditionals like "if (x<0) ..." are treated as imperatives
which are always evaluated. So if x<0 is not known to Maxima, it is
an error.
This is unlike functional expressions like f(3), which if f is
undefined returns the symbolic expression f(3).
Thus, unfortunately, it is not possible to include conditional
expressions in integrands, as you would like:
> (%i1) rect ( x ) ::= if ( abs ( x ) < 1/2 ) then 1 else 0 $
> (%i3) integrate ( rect ( x ) * %e ^ ( -%i * w * x ) / sqrt ( 2 * %
> pi ) );
It is possible to *express* conditional integrands using signum and
abs and the like, but alas Maxima doesn't know anything about actually
integrating them, either in the definite or the indefinite case. At
least in the definite case, you can transform into multiple piecewise
integrals....
-s