MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

A buglet in FunctionExpand

  • To: mathgroup at smc.vnet.net
  • Subject: [mg27665] A buglet in FunctionExpand
  • From: Jack Goldberg <jackgold at math.lsa.umich.edu>
  • Date: Sat, 10 Mar 2001 00:49:55 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

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



  • Prev by Date: Thesis
  • Next by Date: Re: Re: max/min of functions
  • Previous by thread: RE: extracting elements from an expression
  • Next by thread: Re: A buglet in FunctionExpand