Plotting piecewise functions



Hello there:

I am trying to define some simple piecewise-linear functions that I can then plot.  For instance,

(%i01) f(t) := block(
   if 1 < t and t <= 2 then
      return(t-1)
   elseif 2 < t and t < 3 then
      return(3-t)
   else
      return(0))
$

By itself, this evaluates fine, but I cannot get Maxima to graph it.  For instance, I run into trouble when I try:

(%i02) draw2d(explicit(f(t), t, 0, 5));

If graphing is my goal, should I be defining f in a different way?

Thanks!

Jorge
--
Dr. Jorge Alberto Calvo
Associate Professor of Mathematics
Department of Mathematics and Physics
Ave Maria University

Phone: (239) 280-1608
Email: jorge.calvo at avemaria.edu
Web: http://sites.google.com/site/jorgealbertocalvo