how to define a piecewise function



-----Glenn Ramsey wrote: -----

>Next problem. How do I plot the piecewise function?

(%i1) f(x) := if x < 1 then 1-x else x^2;
(%o1) f(x):=if x<1 then 1-x else x^2
(%i2) plot2d('(f(x)),[x,-2,2]);

At the discontinuity, this graph has a bogus
vertical line segment. I don't know how to fix that.

Barton