[Date Index]
[Thread Index]
[Author Index]
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[6]:= Integrate[UnitStep[x],{x,0,3}]
Out[6]= 3
In[7]:= Assuming[a<=b,Integrate[UnitStep[x],{x,a,b}]]
Out[7]= (b UnitStep[-a]+(-a+b) UnitStep[a]) UnitStep[b]
In[8]:= %/.{a->0,b->3}
Out[8]= 6
Out[8] doesn't agree with Out[6], which was correct. This discrepancy is
caused by Out[7] not being correct in general (even when a<=b).
Here's a possible remedy. We define our own unit step:
In[9]:= ourUnitStep[x_]:= (Abs[x]/x + 1)/2
In[10]:= Assuming[a<=b,Integrate[ourUnitStep[x],{x,a,b}]]
Out[10]= 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
>
> load[x_]=-9*10^3*DiracDelta[x]+Piecewise[{{x*10*(10^3/3),
> 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
>
> Integrate[load[x],{x,0,5}]//InputForm
>
> 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[14]:= Assuming[a<=b,
Simplify[Integrate[(x*10*(10^3/3))(ourUnitStep[x]-ourUnitStep[x-3]),{x,a,
b}]]]
Out[14]= 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**
| |