Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: A buglet in FunctionExpand
Replies: 0

 Jack Goldberg Posts: 53 Registered: 12/7/04
A buglet in FunctionExpand
Posted: Mar 10, 2001 1:09 AM

hi group

FunctionExpand is a very powerful tool and like all powerful tools it
should be used with some care. One use I have made of FunctionExpand is
simplifing UnitStep[***]. In doing so I have discovered one bug reported
here a few months ago and now report a buglet, a result that is more or
less correct but not in reasonable form.

Try,

FunctionExpand[ UnitStep[x^2] ]

and you will get

UnitStep[-x]+UnitStep[x]

on a Mac or Unix system running ver 4.0. The output fails to agree with
the input at x = 0. The correct answer is, of course

FunctionExpand[ UnitStep[x^2] ] -> 1 since x^2 >= 0 for all x.

Similar incorrect answers occur when the argument of UnitStep is any
even power of x+a.

Now some additional comments directed at those with a serious interest in
Piecewise Continuous functions:

My experience with identities involving UnitStep suggests that one must
either give up some simplifications in order that the input and output
agree for all real x. Example, if you want UnitStep[-x] to simplify to
1-UnitStep[x] then as above these two functions disagree only for x=0.
Redefining UnitStep[0] = 1/2 leads to the failure of UnitStep[x]^n =
UnitStep[x] at x = 0 for every positive n.

Mathematica provides an interesting partial solution which I came across
quite accidentally:

FunctionExpand[ UnitStep[-x]UnitStep[x] ] -> DiscreteDelta[x]

So,

UnitStep[-x] -> 1-UnitStep[x]+DiscreteDelta[x]

saves this desired identity.

My suggestions to the gurus at Mathematica: Clean up these peculiarities. Either
except the fact that FunctionExpand[ ... something involving UnitStep...]
may lead to an expression differing from the argument of FunctionExpand at
a finite number of points, or use DiscreteDelta systematically. In any
case, UnitStep[x^(2r)] is identically 1!

Jack