       Re: UnitStep

• To: mathgroup at smc.vnet.net
• Subject: [mg52386] Re: UnitStep
• From: "David W. Cantrell" <DWCantrell at sigmaxi.org>
• Date: Thu, 25 Nov 2004 05:50:11 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```On Wed, 24 Nov 2004 22:03, DrBob <drbob at bigfoot.com> wrote:

> >> I don't know why you think it's wrong.
>
> Because THESE are the right answers:
>
> f[x_] = (1/x)*UnitStep[x - 1];
> g[x_] = D[f[x], {x}]
> h[x_] = Simplify[Integrate[g[x], x]]
>
> DiracDelta[-1 + x]/x - UnitStep[-1 + x]/x^2
> UnitStep[-1 + x]/x

I agree that's _a_ right answer for the antiderivative.
Piecewise[{{0, x <= 1}}, -1 + 1/x], which you'd claimed
to be wrong, is also a right answer (and, being
continuous, it is, in a sense, a "nicer" right answer).

> The x==0 case in Piecewise is a red herring, BTW. It's
> removable, yet Mathematica lets it become a problem.
>
> f[x_] = Piecewise[{{0, x == 0}, {(1/x)*UnitStep[x - 1], True}}];
> g[x_] = D[f[x], {x}]
> h[x_] = Integrate[g[x], x]
>
> Piecewise[{{0, x < 1}, {-(1/x^2), x > 1}}, Indeterminate]
> Piecewise[{{0, x <= 1}}, -1 + 1/x]

From the results you've shown, I see no evidence that "Mathematica
lets it become a problem". The results are fine.

> Both definitions above for f are identical, point by point and in
> form at the only discontinuity. I'm not saying Mathematica should
> have gotten this right, but I _am_ saying it got it wrong.

And I still don't know why you think that Mathematica got it wrong.
The answer Piecewise[{{0, x <= 1}}, -1 + 1/x] is _a_ correct one.

I should also take this opportunity to correct something I'd said
previously. I had said "But due to the discontinuity, an antiderivative
of the derivative of f need not be f itself." I'd actually intended to say
that, due to the discontinuity, an antiderivative of the derivative of f
need not merely differ from f by a constant.

David Cantrell

> On Wed, 24 Nov 2004 10:06:58 -0500 (EST), David W. Cantrell
<DWCantrell at sigmaxi.org> wrote:
>
> > DrBob <drbob at bigfoot.com> wrote:
> > [snip]
> >> In version 5.1 we have a different choice:
> >>
> >> (inputs)
> >> f[p_] = Piecewise[{{0, p == 0}, {(1/p) UnitStep[p - 1], True}}];
> >> Integrate[f@x, {x, -5, 5}]
> >> D[f@x, {x}]
> >> Integrate[%, x]
> >> Plot[f@x, {x, -5, 5}]
> >>
> >> (outputs)
> >> Log
> >> Piecewise[{{0, x < 1}, {-(1/x^2), x > 1}}, Indeterminate]
> >> Piecewise[{{0, x <= 1}}, -1 + 1/x]
> >> (and a plot)
> >>
> >> This time D followed by Integrate is evaluated, but WRONG.
> >
> > I don't know why you think it's wrong. But in fact, it is not only
> > right, but also clever. Note that the original function is
> > discontinuous, as is its derivative. Then when we Integrate
> > that, we need to get an antiderivative of the derivative of f.
> > But due to the discontinuity, an antiderivative of the derivative
> > of f need not be f itself. To confirm that
> > the result of Integrate is correct, just differentiate that result
> >
> > Piecewise[{{0, x <= 1}}, -1 + 1/x]
> >
> >
> > Piecewise[{{0, x < 1}, {-(1/x^2), x > 1}}, Indeterminate]
> >
> > just as desired?
> >
> > The antiderivative is clever because Mathematica chose -1 as the
> > constant of integration in the part for x > 1, thereby nicely making
> > the antiderivative continuous.
> >
> > David Cantrell

```

• Prev by Date: Re: UnitStep
• Next by Date: Re: Re: Piecewise symbol in 5.1
• Previous by thread: Re: UnitStep
• Next by thread: Re: UnitStep