MathGroup Archive 2007

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

Search the Archive

version 6.0 Plot[___,Exclusions->Automatic]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76257] version 6.0 Plot[___,Exclusions->Automatic]
  • From: "Lev Bishop" <lev.bishop at gmail.com>
  • Date: Fri, 18 May 2007 06:24:21 -0400 (EDT)

Mathematica version 6.0 has a nice feature in it's Plot[] function
that automatically looks for discontinuities so it can draw them in
ExclusionsStyle. You can explicitly set the Exclusions option for
functions of your own that Plot[] cannot find the discontinuities in
(eg, because they only evaluate for ?NumericQ). I couldn't find a
documented method for doing this but, the following seems to work:

ff[x_?NumericQ]:=Floor[2x]+0.1; (*Define a numeric function *)
Plot[ff@x,{x,0,4},ExclusionsStyle->Red](*Plot[] doesn't know where the
discontinuities are*)

Visualization`DiscontinuityDump`Discontinuities[ff[x_],z_]:=Visualization`DiscontinuityDump`Discontinuities[Floor[2x],z];
(* ff[x] has the discontinuities at the same places as Floor[2x]*)
Plot[ff@x,{x,0,4},ExclusionsStyle->Red] (*Now it works*)
Plot[Sin@ff@Cos@x,{x,0,4},ExclusionsStyle->Red](*Even in more complex cases*)

Hope that's useful to someone,
Lev


  • Prev by Date: Re: Re: Re: Re: Where is the Mathematica
  • Next by Date: Re: Integrate[s^s(1-s)^(1-s)Sin[Pi s],{s,0,1}]
  • Previous by thread: Re: Re: Re: Re: Where is the Mathematica
  • Next by thread: Re: version 6.0 Plot[___,Exclusions->Automatic]