MathGroup Archive 1995

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

Search the Archive

Re: Plotting Piecewise Functions with Discontinuites


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];
	     p_/;Greater@@(Abs/@(Subtract@@p){n ar,1}):>Line[p]
   Show[graphNA, DisplayFunction -> $DisplayFunction]

Allan Hayes
De Montfort University Leicester
hay at

  • Prev by Date: WordPerfect
  • Next by Date: Help reduce this expression (Not Long)
  • Previous by thread: WordPerfect
  • Next by thread: Help reduce this expression (Not Long)