MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: gaps in plot of piecewise function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108220] Re: [mg108217] gaps in plot of piecewise function
  • From: "David Park" <djmpark at comcast.net>
  • Date: Thu, 11 Mar 2010 06:34:08 -0500 (EST)
  • References: <30604342.1268221205458.JavaMail.root@n11>

I'm not certain of the exact underlying mechanics, but basically because of
the steep curve as x -> 2 from below, and the piecewise function,
Mathematica sees a discontinuity and leaves a gap. The way to overcome this
is to use the Exclusions option.

s[x_] := Piecewise[{{-Sqrt[2]/2*Sqrt[-x + 0.5] + 2, x < 0.5}, {2, 
     x >= 0.5}}];  

Plot[s[x], {x, 0, 1},
 Exclusions -> None,
 Frame -> True,
 PlotRangePadding -> .1] 


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  


From: Benjamin Hell [mailto:hell at exoneon.de] 

Hi,
I want to plot a piecewise function, but I don't want any gaps to appear 
at the junctures. An easy example is:

s[x_] := Piecewise[{{-Sqrt[2]/2*Sqrt[-x + 0.5] + 2, x < 0.5}, {2, x >= 
0.5}}];
Plot[s[x], {x, 0, 1}]

It should be clear, that the piecewise function defined above is 
continuous, even at x=0.5. So there should not be any gaps appearing in 
the plot, but they do. Maybe it's a feature of mathematica, but 
nevertheless I want to get rid of the gaps. Any suggestions on how to 
achieve that.


Thanks in advance.




  • Prev by Date: Re: gaps in plot of piecewise function
  • Next by Date: Re: Re: Dynamically set variable name and value
  • Previous by thread: Re: gaps in plot of piecewise function
  • Next by thread: Re: Re: gaps in plot of piecewise function