Re: Plotting Piecewise Functions with Discontinuites
- To: mathgroup at christensen.cybernetics.net
- Subject: [mg1985] Re: [mg1974] Plotting Piecewise Functions with Discontinuites
- From: Allan Hayes <hay at haystack.demon.co.uk>
- Date: Mon, 4 Sep 1995 22:22:41 -0400
CORRECTION:
Please replace "max" and "min" in the third line of the code
with "a" and "b" respectively to get:
PlotNA[f_,{x_,a_,b_},n:(_Integer?Positive):25, opts___?OptionQ] :=
Module[ {graph,ar,graphNA,pairs},
graph = Plot[f, {x,a,b}, DisplayFunction->Identity,opts];
ar = Divide@@Reverse[FullOptions[graph,PlotRange].{-1,1}];
graphNA =
graph/.Line[lst_] :>
(pairs = Partition[lst, 2, 1];
Cases[pairs,
p_/;Greater@@(Abs/@(Subtract@@p){n ar,1}):>Line[p]
]
);
Show[graphNA, DisplayFunction -> $DisplayFunction]
]
Allan Hayes
De Montfort University Leicester
hay at haystack.demon.co.uk