Re: Re: Clever Tricky Solutions
- To: mathgroup at smc.vnet.net
- Subject: [mg94279] Re: [mg94231] Re: Clever Tricky Solutions
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Tue, 9 Dec 2008 07:02:29 -0500 (EST)
- Organization: Mathematics & Statistics, Univ. of Mass./Amherst
- References: <27271771.1228394784179.JavaMail.root@m02> <ghavpg$o9j$1@smc.vnet.net> <ghg9c3$hos$1@smc.vnet.net> <200812081124.GAA15942@smc.vnet.net>
- Reply-to: murray at math.umass.edu
Perhaps it's time for us to begin thinking about avoiding Show whenever possible! Users of older Mathematica versions became so familiar with Show when it was used, among other things, to display a plot built up in parts, with each of the parts having the graphical output suppressed. The original poster's question was about plotting together, on the same set of axes, Sin[Pi x]/2 for 1 <= x <= 2 and Sin[Pi x] for 0 <= x < 1. Now this seems to be not the most usual thing to do: two different functions, with different domains, plotted on a single set of axes. Should the result mean, really, two different functions, on the one hand, or, more likely, two pieces of the same function. So was the intention really to plot a "piecewise-defined" function? If so, the the obvious thing would seem to be (what perhaps another poster already mentioned), namely, to use Piecewise: Plot[Piecewise[{{Sin[Pi x]/2,x>=1},{Sin[Pi x],x<1}}],{x,0,2}] That takes care of the PlotRange problem, of course. Or one could do essentially the same thing, but in the spirit of what one does when combining functions before taking their Laplace transforms: Plot[Boole[x<1]Sin[Pi x] + Boole[x>=1]Sin[Pi x]/2,{x,0,2}] That's my two cents. (But none of the above is meant to "excuse" what might possibly be a bade design decision about default PlotRange.) Helen Read wrote: > congruentialuminaire at yahoo.com wrote: >> OK Helen: >> >> I do vaguely remember something about this. Of course, your students >> can use SetOptions[Plot, PlotRange->All] or the like. > > But the default for Plot (and PolarPlot, ParametricPlot, Plot3D, etc.) > is *already* PlotRange->Automatic. The problem is that by default Show > no longer combines the PlotRanges automatically, but instead simply > takes the PlotRange from the first graphic. > >> But what is not clear to me is: >> >> - both V5.2 and V6 evaluate Options[Plot,PlotRange] to Automatic. So >> it seems that the default PlotRange default itself has *not* changed; >> just the meaning of the default [i.e. Automatic] is different now!?! > > It is the behavior of Show that has changed, and since PlotRange is not > even an option for Show (despite the fact that one can set a PlotRange > within Show), there is no way to change this with SetOptions. > -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305
- References:
- Re: Clever Tricky Solutions
- From: Helen Read <hpr@together.net>
- Re: Clever Tricky Solutions