Re: UnitStep

• To: mathgroup at smc.vnet.net
• Subject: [mg52383] Re: UnitStep
• From: DrBob <drbob at bigfoot.com>
• Date: Thu, 25 Nov 2004 05:50:03 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

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

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]

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. (That's life, when we use a CAS.)

The OP's original problem should not have occurred at all. UnitStep[x-c] f[x] is a well-behaved function if f[x] is well-behaved for x >= c. The behavior of f on x < c is (or should be) irrelevant.

Bobby

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[5]
>> 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
>
>
>

--
DrBob at bigfoot.com
www.eclecticdreams.net

```

• Prev by Date: launching a kernel on a remote linux machine through ssh from a linux machine
• Next by Date: Re: UnitStep
• Previous by thread: Re: UnitStep
• Next by thread: Re: UnitStep