Re: version 6.0 Plot[___,Exclusions->Automatic]
- To: mathgroup at smc.vnet.net
- Subject: [mg76312] Re: version 6.0 Plot[___,Exclusions->Automatic]
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Sat, 19 May 2007 04:46:10 -0400 (EDT)
- References: <f2k0a8$e3v$1@smc.vnet.net>
Hi,
with your definition
ff[x_?NumericQ]:=Floor[2x]+0.1;
you hinder Mathematicas symbolic engine to take a
look onto the discontinuities.
If you say
ff[x_] := Floor[2 x] + 0.1;(*Define a numeric function*)
Plot[
Evaluate[ff@x], {x, 0, 4}, ExclusionsStyle -> Red]
or
Plot[ff@x, {x, 0, 4}, ExclusionsStyle -> Red, Evaluated -> True]
it work as expected.
Regards
Jens
Lev Bishop wrote:
> 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
>
- Follow-Ups:
- Re: Re: version 6.0 Plot[___,Exclusions->Automatic]
- From: Murray Eisenberg <murray@math.umass.edu>
- Re: Re: version 6.0 Plot[___,Exclusions->Automatic]