Re: Poor choice in PiecewiseExpand ?

*To*: mathgroup at smc.vnet.net*Subject*: [mg107586] Re: [mg107550] Poor choice in PiecewiseExpand ?*From*: DrMajorBob <btreat1 at austin.rr.com>*Date*: Thu, 18 Feb 2010 05:17:04 -0500 (EST)*References*: <201002160855.DAA01520@smc.vnet.net>*Reply-to*: drmajorbob at yahoo.com

I got to the part after 3 later on; you were right about that, and I agreed that it is a bug. Also, this: >> expr3 = Which[0 < x <= 1, 1, >> 1 < x <= 2, 2, >> 2 < x < 3, 3, >> True, 0] should have been expr3 = Which[0 < x <= 1, 1, 1 < x <= 2, 2, 2 < x <= 3, 3, True, 0] Bobby On Tue, 16 Feb 2010 21:24:04 -0600, Jack L Goldberg 1 <jackgold at umich.edu> wrote: > Hi Bobby, > > I don't think I made my self clear here, or I don't understand your > comment: > >> No. Mathematica computing Ceiling[x], just like you told it to, and >> Ceiling is left-continuous. For instance, Ceiling@2 is 2. > > I was referring to all values of x > 3 not just x = 3. The graph from > -2 to 5 of the piecewise expand function shows what I mean. > > By the way, thank you for all your insightful posts. I read them all. > Keep up the good work. > > Jack > > > > Quoting DrMajorBob <btreat1 at austin.rr.com>: > >> Yes, that's a BUG. >> >> Here's your original expression and its output: >> >> expr1=PiecewiseExpand[Ceiling[x],0<=x<=3] >> >> \[Piecewise]1 0<x<=1 >> 2 1<x<=2 >> 3 x>2 >> 0 True >> >> And here's an equivalent Which (you had the arguments out of order): >> >> expr2=Which[0<x<=1,1, >> 1<x<=2,2, >> x>2,3, >> True,0] >> >> expr1 == expr2 // Simplify >> >> True >> >>> My beef (confusion) is with the values given in Out[1] when x > 3. >>> (This issue arises in Floor[x] and other such functions.) Why is the >>> value 3 ? Since the assumption is that x lies in [0,3], giving a >>> value of x outside this interval should result in an error message. >>> No?. >> >> No. You used PiecewiseExpand, so the result was Piecewise. Piecewise >> makes no assumptions; it tests x, then returns a value. It ALWAYS >> returns a value. >> >>> Mathematica decided to make this function continuous with the values >>> at the >>> end points of the assumed interval, where possible. >> >> No. Mathematica computing Ceiling[x], just like you told it to, and >> Ceiling is left-continuous. For instance, Ceiling@2 is 2. >> >>> My own feeling is that outside the assumed region, PiecewiseExpand >>> should return 0 if anything. >> >> On that, you're correct, and it's a bug. The correct output of >> PiecewiseExpand would be >> >> expr3 = Which[0 < x <= 1, 1, >> 1 < x <= 2, 2, >> 2 < x < 3, 3, >> True, 0] >> >> Bobby >> >> On Tue, 16 Feb 2010 02:55:41 -0600, Jack L Goldberg 1 >> <jackgold at umich.edu> wrote: >> >>> Hi Folks, >>> >>> I am running ver. 7.01.0 on a MackBookPro using OS 10.6.2. >>> >>> In[1] PiecewiseExpand[Ceiling[x], 0 <= x <= 3] >>> >>> For clarity, I write the piecewise output in the form of a "Which" >>> command. It DOES NOT display as "Which", of course. >>> >>> Out[1] Which[1, 1 <= x < 2, 2, 2 <= x <= 3, 3, x >= 3, 0, True] >>> >>> >>> My beef (confusion) is with the values given in Out[1] when x > 3. >>> (This issue arises in Floor[x] and other such functions.) Why is the >>> value 3 ? Since the assumption is that x lies in [0,3], giving a >>> value of x outside this interval should result in an error message. >>> No?. By the way, the value returned for x = -1 is zero so clearly(?) >>> Mathematica decided to make this function continuous with the values >>> at the >>> end points of the assumed interval, where possible. Is this a >>> documented feature of PiecewiseExpand? Is it even a good idea? >>> >>> I can live with this "feature" by the way. I just wish I hadn't had >>> to discovered it after spending much time fooling around with >>> PiecewiseExpand in other code that I am writing. >>> >>> My own feeling is that outside the assumed region, PiecewiseExpand >>> should return 0 if anything. >>> >>> Jack >>> >>> >> >> >> --DrMajorBob at yahoo.com >> >> >> > > -- DrMajorBob at yahoo.com

**References**:**Poor choice in PiecewiseExpand ?***From:*Jack L Goldberg 1 <jackgold@umich.edu>

**Re: Re: May we trust IntegerQ ?**

**Re: Strange behaviour of Plot**

**Re: Poor choice in PiecewiseExpand ?**

**Re: Poor choice in PiecewiseExpand ?**