       Re: piecewise integration

• To: mathgroup at smc.vnet.net
• Subject: [mg66968] Re: piecewise integration
• From: "David W.Cantrell" <DWCantrell at sigmaxi.org>
• Date: Mon, 5 Jun 2006 03:48:41 -0400 (EDT)
• References: <e5tt8l\$ebs\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```"Chris Chiasson" <chris at chiasson.name> wrote:
> The Integrate result seems pretty weak. Is there any way to obtain a
> more explicit exact answer besides manually converting the Piecewise
> function to two UnitStep functions?

I'm not sure. That's _essentially_ (but not literally) what I'd do.

> Can the same be done if the final limit of integration is a variable?

Yes.

Are you aware that (at least in version 5.1) using variable limits of
integration over UnitStep can reveal a bug? For example:

In:= Integrate[UnitStep[x],{x,0,3}]
Out= 3

In:= Assuming[a<=b,Integrate[UnitStep[x],{x,a,b}]]
Out= (b UnitStep[-a]+(-a+b) UnitStep[a]) UnitStep[b]

In:= %/.{a->0,b->3}
Out= 6

Out doesn't agree with Out, which was correct. This discrepancy is
caused by Out not being correct in general (even when a<=b).

Here's a possible remedy. We define our own unit step:

In:= ourUnitStep[x_]:= (Abs[x]/x + 1)/2

In:= Assuming[a<=b,Integrate[ourUnitStep[x],{x,a,b}]]
Out= Piecewise[{{-a, a > 0 && b < 0 && a - b >= 0}, {b, b > 0 && a <
0}, {-2*a + b, a > 0 && b < 0 && a - b < 0}, {-a + b, (a == 0 && a - b < 0)
|| (a >= 0 && b >= 0 && a - b < 0)}}]

Messy, but AFAIK, correct whenever a <= b.

> in
>
> 0<=x<=3}}]-6*10^3*DiracDelta[x-5]//InputForm
>
> out
>
> -6000*DiracDelta[-5 + x] - 9000*DiracDelta[x] +
> Piecewise[{{(10000*x)/3, 0 <= x <= 3}}, 0]
>
> in
>
>
> out
>
> Integrate[InputForm[-6000*DiracDelta[-5 + x] - 9000*DiracDelta[x] +
> Piecewise[{{(10000*x)/3, 0 <= x <= 3}}, 0]], {x, 0, 5}]

Neglecting the DiracDelta terms,

In:= Assuming[a<=b,
Simplify[Integrate[(x*10*(10^3/3))(ourUnitStep[x]-ourUnitStep[x-3]),{x,a,
b}]]]

Out= Piecewise[{{15000, b > 3 && a < 0}, {(-(5000/3))*(-9 + a^2), 0 <=
a < 3 && b > 3}, {(5000*b^2)/3, a < 0 && 0 < b <= 3}, {(-(5000/3))*(a^2 -
b^2), a < b && b <= 3 && (a == 0 || (a < 3 && 0 <= a && 0 <= b))}}]

The contributions from the DiracDelta terms can then be added to that.
(For some reason, I was unable to get the integral to evaluate if the
DiracDelta terms were present.)

David

```

• Prev by Date: Re: piecewise integration
• Next by Date: Re: Re: Simplifying algebraic expressions
• Previous by thread: Re: piecewise integration
• Next by thread: Re: piecewise integration