Re: How to plot discontinuous functions?
- To: mathgroup at smc.vnet.net
 - Subject: [mg90151] Re: How to plot discontinuous functions?
 - From: dh <dh at metrohm.ch>
 - Date: Tue, 1 Jul 2008 06:56:45 -0400 (EDT)
 - References: <g4a6tv$8uh$1@smc.vnet.net>
 
Hi Aaron,
I think Mathematica does not recognize the piecewise function because the Head 
of your expression is actually Part. Plot does therefore not know about 
the discontinuity.
Daniel
Aaron Fude wrote:
> Hi,
> 
> If a function is defined via If, then when plotted it does not
> acknowledge the discontinuity. E.g.
> 
> f[x_] := If[x < 1, 1, 2];
> Plot[f[x], {x, 0, 2}, PlotRange -> {0, 3}]
> 
> Defined via Piecewise, it does, but in my experience, not always:
> f[x_] := Piecewise[{{{1, 1}, x < 1}}, {2, 2}];
> Plot[f[x][[1]], {x, 0, 2}, PlotRange -> {0, 3}]
> 
> How do I make the Plot function try to acknowledge the discontuity by
> not connecting the left limit and the right limit?
> 
> Thanks,
> 
> Aaron
> 
-- 
Daniel Huber
Metrohm Ltd.
Oberdorfstr. 68
CH-9100 Herisau
Tel. +41 71 353 8585, Fax +41 71 353 8907
E-Mail:<mailto:dh at metrohm.com>
Internet:<http://www.metrohm.com>