Re: UnitStep

*To*: mathgroup at smc.vnet.net*Subject*: [mg52388] Re: UnitStep*From*: DrBob <drbob at bigfoot.com>*Date*: Thu, 25 Nov 2004 05:50:19 -0500 (EST)*References*: <20041124100658.160$aO@newsreader.com> <opshzov1mviz9bcq@monster> <001001c4d280$561155c0$b5803e44@Dell>*Reply-to*: drbob at bigfoot.com*Sender*: owner-wri-mathgroup at wolfram.com

If we're dealing with functional calculus, the derivative of UnitStep is DiracDelta. In that case, the problem is in D (not Integrate), because it doesn't differentiate UnitStep consistently in the two versions of f. My naive understanding of the indefinite integral is a Lebesgue integral that (conceptually) leaves the lower limit unspecified, which implies an arbitrary additive constant -- not a piecewise constant function. Defining antiderivative to mean a right-inverse of D (D[Integrate[g,x],x] == g[x] a.e.) is defensible in the right context, but 1) That's not everybody's default interpretation. (It's certainly not mine!) 2) It's not documented in Help. 3) It breaks the Fundamental Theorem of Integral Calculus. On that point, here's an example: (inputs) c[x_] = Piecewise[{{0, x < 1}, {1, x < 2}, {2, x < 3}}, 4]; integral[x_] = Integrate[x^2, x] + c[x]; Derivative[1][integral][x] integral[2.5] - integral[1.5] Integrate[x^2, {x, 1.5, 2.5}] (outputs) x^2 + Piecewise[{{0, x < 1 || 1 < x < 2 || 2 < x < 3 || x > 3}}, Indeterminate] 5.083333333333333 4.083333333333333 If your definition of indefinite integral doesn't satisfy the Fundamental Theorem, are you SURE it's the right definition? Bobby On Wed, 24 Nov 2004 23:50:06 -0000, David W. Cantrell <DWCantrell at sigmaxi.org> wrote: > > > 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. > But it's not the only right answer, of course. The answer > 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[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] >> > >> > in your head. Don't you get >> > >> > 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