Re: Poor choice in PiecewiseExpand ?

• To: mathgroup at smc.vnet.net
• Subject: [mg107565] Re: [mg107550] Poor choice in PiecewiseExpand ?
• From: "David Park" <djmpark at comcast.net>
• Date: Wed, 17 Feb 2010 07:03:04 -0500 (EST)
• References: <5792771.1266312510332.JavaMail.root@n11>

```Jack,

If you want this as a function I would think it necessary to include the
domain restriction in the function definition as well as in PiecewiseExpand.
So:

f[x_ /; 0 <= x <= 3] = PiecewiseExpand[Ceiling[x], 0 <= x <= 3]

Plot[f[x], {x, -1, 4},
Frame -> True, Axes -> False,
PlotRange -> {-1, 4},
Exclusions -> Range[0, 3],
Epilog -> {AbsolutePointSize[5], Point[{#, f[#]}] & /@ Range[0, 3]}]

This looks all right to me, giving the correct values within the domain, and
being undefined outside of the domain.

Or here is another approach:

g[x_] = PiecewiseExpand[If[0 <= x <= 3, Ceiling[x], Indeterminate]]

Plot[g[x], {x, -1, 4},
Frame -> True, Axes -> False,
PlotRange -> {-1, 4},
Exclusions -> Range[0, 3],
Epilog -> {AbsolutePointSize[5], Point[{#, f[#]}] & /@ Range[0, 3]}]

David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/

From: Jack L Goldberg 1 [mailto:jackgold at umich.edu]

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

```

• Prev by Date: simple BSpline surfaces could not be exported
• Next by Date: Re: Re: Re: May we trust IntegerQ ?
• Previous by thread: Re: Poor choice in PiecewiseExpand ?