Re: Problems with Plot in Mathematica 4.0

• To: mathgroup at smc.vnet.net
• Subject: [mg45839] Re: Problems with Plot in Mathematica 4.0
• From: bobhanlon at aol.com (Bob Hanlon)
• Date: Tue, 27 Jan 2004 04:50:32 -0500 (EST)
• References: <bv2f3b\$2g\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Needs["Graphics`Graphics`"];

f1[x_] := 0.5x^2-x;
f2[x_] := -0.5x^2+x;

This works for any functions and whether or not they share a domain boundary

DisplayTogether[
Plot[f1[x],{x,-3,0}],
Plot[f2[x],{x,0,3}],
PlotRange->All];

Since your functions are piecewise continuous you can turn one off and the
other on at the common domain boundary

Plot[
f1[x]+UnitStep[x]*(f2[x]-f1[x]),
{x,-3,3}, PlotRange->All];

Or, since your two functions share a common form you can combine them into a
single function.

Plot[Abs[x](1-0.5x), {x,-3,3},
PlotRange->All];

Bob Hanlon

In article <bv2f3b\$2g\$1 at smc.vnet.net>, "Manfred Fischer" <manfis at t-online.de>
wrote:

<< I want to plot the two functions in one Plot output
+0.5x^2-x (definition-range -3<=x<=0)
-0.5x^2+x (definition-range 0<=x<=3)