Re: Poor choice in PiecewiseExpand ?
- To: mathgroup at smc.vnet.net
- Subject: [mg107553] Re: [mg107550] Poor choice in PiecewiseExpand ?
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Wed, 17 Feb 2010 07:00:53 -0500 (EST)
- Reply-to: hanlonr at cox.net
If you intend for it to be zero outside the interval, then define the function in that manner. f[x_] = PiecewiseExpand[Piecewise[{{Ceiling[x], 0 <= x <= 3}}]] f /@ Range[-1, 4, .5] {0,0,0,1,1,2,2,3,3,0,0} Bob Hanlon ---- 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