Re: Integration of UnitStep has bugs!? help!
- To: mathgroup at smc.vnet.net
- Subject: [mg51616] Re: Integration of UnitStep has bugs!? help!
- From: "Dr. Wolfgang Hintze" <weh at snafu.de>
- Date: Wed, 27 Oct 2004 01:54:38 -0400 (EDT)
- References: <clcnlr$q41$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
It's not a bug. Mathematic is simply careful. It needs to know more about t to carry on. You need simply to state that t is real. Here we go: Either during Simplify In[13]:= x[t_] = 3*Exp[-t/2]*UnitStep[t] + DiracDelta[t + 3]; h[t_] = UnitStep[t] - UnitStep[t - 2]; eq1 = Integrate[x[a]*h[t - a], {a, -Infinity, Infinity}]; eq2 = Integrate[x[a]*h[t - a], {a, 0, Infinity}]; eq3 = Integrate[x[a]*h[t - a], {a, -Infinity, 0}]; Simplify[eq1, t \[Element] Reals] Simplify[eq2 + eq3, t \[Element] Reals] Out[15]= (-6 + 6*E^(1 - t/2))*UnitStep[-2 + t] + (6 - 6/E^(t/2))*UnitStep[t] - UnitStep[1 + t] + UnitStep[3 + t] Out[16]= (-6 + 6*E^(1 - t/2))*UnitStep[-2 + t] + (6 - 6/E^(t/2))*UnitStep[t] - UnitStep[1 + t] + UnitStep[3 + t] or even in doing Integrate (using Assumptions) In[18]:= eq1 = Integrate[x[a]*h[t - a], {a, -Infinity, Infinity}, Assumptions -> t \[Element] Reals] Out[18]= (-6 + 6*E^(1 - t/2))*UnitStep[-2 + t] + (6 - 6/E^(t/2))*UnitStep[t] - UnitStep[1 + t] + UnitStep[3 + t] Hence it works fine (in Mathematica 4.0. I hope it does the same in 5). Wolfgang news wrote: > Can anyone explain why Integrate does not work propery with UnitStep > function? When you integrate from -inf to inf you get one answer, but when > you split it to two sections (from -inf to 0, and then from 0 to +inf) you > get a different answer. Which is correct? And why is Mathematica version 5 > has not fixed this problem yet? See below. > > In[1]:= > \!\(\(x[t_] = \((3 Exp[\(\(-1\)\/2\) t] UnitStep[t])\) + > DiracDelta[t + 3];\)\[IndentingNewLine] > \(h[t_] = UnitStep[t] - UnitStep[t - 2];\)\[IndentingNewLine] > \(eq1 = > Integrate[ > x[a] h[t - > a], {a, \(-\[Infinity]\), \[Infinity]}];\)\[IndentingNewLine] > \(eq2 = Integrate[x[a] h[t - a], {a, 0, \[Infinity]}];\)\[IndentingNewLine] > \(eq3 = > Integrate[ > x[a] h[t - a], {a, \(-\[Infinity]\), 0}];\)\[IndentingNewLine] > eq1\ // FullSimplify\[IndentingNewLine] > eq2 + eq3 // FullSimplify\) > Out[6]= > \!\(1\/2\ \((\(-\(\(6\ \((\(-2\) + > t)\)\)\/\@\((\(-2\) + t)\)\^2\)\) + \(6\ t\)\/\@t\^2 - \ > \(1 + t\)\/\@\((1 + t)\)\^2 + \(3 + t\)\/\@\((3 + t)\)\^2)\)\) > Out[7]= > \!\(1\/2\ \((\(-\(\(1 + > t\)\/\@\((1 + t)\)\^2\)\) + \(3 + t\)\/\@\((3 + t)\)\^2)\) \ > + 6\ \((\(-1\) + \[ExponentialE]\^\(1 - t\/2\))\)\ UnitStep[\(-2\) + > t] + \((6 - 6\ \[ExponentialE]\^\(\(-t\)/2\))\)\ UnitStep[t]\) > >