Re: Re: difference between HeavisidePi and UnitBox

*To*: mathgroup at smc.vnet.net*Subject*: [mg100425] Re: [mg100364] Re: difference between HeavisidePi and UnitBox*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Wed, 3 Jun 2009 01:11:22 -0400 (EDT)*References*: <gvq08j$moo$1@smc.vnet.net> <gvtmcu$gc6$1@smc.vnet.net> <200906021041.GAA08533@smc.vnet.net>

It depends on your purpose. For some simple purposes they are equivalent but there is a huge difference when you try to do calculus with them. You can perform most natural operations such as differentiation or integration on generalized functions: D[HeavisidePi[x], x] 2*DiracDelta[2*x + 1] - 2*DiracDelta[2*x - 1] which is a well behaved generalized function while D[UnitBox[x], x] Piecewise[{{Indeterminate, x == 1/2 || x == -(1/2)}}, 0] is the zero function with two undefined values at 1/2 and -1/2, basically a useless object. So, for example: Integrate[D[HeavisidePi[x], x], {x, -Infinity, 0}] 1 while naturally Integrate[D[UnitBox[x], x], {x, -Infinity, 0}] 0 I came up with these examples just off hand so they may look a bit artificial but it is easy to find ones that arise in serious problems. Andrzej Kozlowski On 2 Jun 2009, at 19:41, Anatoly wrote: > I understand that it doesn't matter. There's even some discussion > here about it http://mathworld.wolfram.com/RectangleFunction.html > > My question is regarding "The piecewise version of the rectangle > function is implemented in Mathematica as UnitBox[x], while the > generalized function version is implemented as HeavisidePi[x]." > > why do we need both? I find the integral transforms (I use mostly > FourierTransform) actually work much better with the piecewise UnitBox > for 5-bar patterns that I like to use. > > Does anyone have a thorough explanation of when generalized functions > are better than piecewise and vice versa? > > -Anatoly > > On May 31, 6:33 pm, Jens-Peer Kuska <ku... at informatik.uni-leipzig.de> > wrote: >> Hi, >> >> what happens at x->1/2 and x->-1/2 with HeavisidePi[] and >> UnitBox[] ? >> >> For distributions like HeavisidePi[] that are used >> inside of an integral the single >> point does not matter. For functions like UnitBox[] it may be >> important. >> >> Regards >> Jens >> >> >> >> Anatoly wrote: >>> I am a very new user, and am not quite clear on the difference >>> between >>> general (HeavisidePi) and numerical (UnitBox, or piecewise) >>> functions. >> >>> When I try to create a 5-bar pattern using one of these and apply a >>> FourierTransform, I have varying degrees of success... >> >>> With HeavisidePi I can create an infinite series of them and >>> FourierTransform has no problems, but it doesn't like modifying the >>> argument as in HeavisidePi(x/w) >> >>> With UnitBox I have the opposite issue. >> >>> Is there a clear explanation on the difference between the two >>> groups >>> of functions, and when I should use which? > >

**References**:**Re: difference between HeavisidePi and UnitBox***From:*Anatoly <anatoly.bourov@gmail.com>