MathGroup Archive 2009

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

Search the Archive

Re: difference between HeavisidePi and UnitBox


I agree with what you say here, but as a user of this functionality let 
me amplify a bit.

Andrzej Kozlowski wrote:
> 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.

The basic issue is that "function", "derivative", and "integral" mean 
different things in different mathematical contexts. For the benefit of 
those who haven't encountered this, start at page 255 of:,M1

for a fine overview of these issues.

> 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.

UnitBox has the unfortunate property that it doesn't have derivatives at 
the important points. On the other side, HeavisideTheta isn't numeric at 
those points, so it would be troublesome in numerical analysis. Which 
one you should choose depends on what you're going to do with them.

Now, this isn't really much of a problem when using the math to solve an 
scientific or engineering problem by hand: the physical nature of the 
problem determines the interpretation of the mathematical symbols. Most 
scientists and engineers aren't even aware of the issues here, and those 
of us who are rarely worry about them when scribbling on the back of the 
envelope. But Mathematica only sees the symbols, not the reality (if 
any) behind them.

> 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.

Not so artificial when you realize that Mathematica is likely to 
evaluate such expressions as it breaks down more realistic problems.

I suspect this is exactly the kind of thing behind the difficulties 
Mathematica used to have when given calculations that required 
generalized functions:

In the early days, Wolfram apparently believed that these issues could 
be finessed by heuristics similar to the way we do applied math by hand. 
So, the only explicit generalized function was DiracDelta, and 
UnitStep's treatment depended on the undocumented heuristics. That 
didn't work very well.

In recent versions, since the introduction of the distinction between 
the Heaviside generalized functions and their numerical counterparts, 
Mathematica's behavior in this area has been much better.

For me, the main application here is in analyzing "noises", such as 
"white" and "flicker" noise:

For some purposes here, it's very handy to do symbolic calculations 
using generalized functions, rather than numerical simulations.

> 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
>> 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?
> ...

John Doty, Noqsi Aerospace, Ltd.
The axiomatic method of mathematics is one of the great achievements of 
our culture. However, it is only a method. Whereas the facts of 
mathematics once discovered will never change, the method by which these 
facts are verified has changed many times in the past, and it would be 
foolhardy to expect that changes will not occur again at some future 
date. - Gian-Carlo Rota

  • Prev by Date: Re: directionfields from StreamPlot looks different from solution
  • Next by Date: Re: RandomReal gets stuck
  • Previous by thread: Re: Re: difference between HeavisidePi and UnitBox
  • Next by thread: Re: difference between HeavisidePi and UnitBox