Re: Re: need help with integration

*To*: mathgroup at smc.vnet.net*Subject*: [mg52086] Re: Re: need help with integration*From*: "symbio" <symbio at has.com>*Date*: Wed, 10 Nov 2004 04:45:28 -0500 (EST)*References*: <cmhv6l$pqv$1@smc.vnet.net> <cmklju$jk2$1@smc.vnet.net> <200411080813.DAA07936@smc.vnet.net> <cmppj3$mj4$1@smc.vnet.net>*Reply-to*: "symbio" <symbio at sha.com>*Sender*: owner-wri-mathgroup at wolfram.com

Equation eq2+eq3 is the correct value for sure, I've verified through Frequency domain (remember this is just a convolution integral). eq1 is not being calculated correctly by Mathematica. It seems to be a bug , I wonder what Wolfram has to say about it. "DrBob" <drbob at bigfoot.com> wrote in message news:cmppj3$mj4$1 at smc.vnet.net... > Symbio seems to be right, but a solution CAN be salvaged. > > Here's Wolfgang's code from David's link, executed in Mathematica 5.0.1: > > 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] > FullSimplify[eq2 + eq3, t \[Element] Reals] > > (1/2)*(-((6*(-2 + t))/ Abs[-2 + t]) + > (6*t)/Abs[t] - (1 + t)/Abs[1 + t] + (3 + t)/Abs[3 + t]) > -((1 + t)/(2*Abs[1 + t])) + (3 + t)/(2*Abs[3 + t]) + > 6*((-1 + E^(1 - t/2))*UnitStep[-2 + t] + UnitStep[t] - UnitStep[t]/ > E^(t/2)) > > Plot[{(1/2)*(-((6*(-2 + t))/Abs[-2 + t]) + > (6*t)/Abs[t] - (1 + t)/Abs[1 + t] + > (3 + t)/Abs[3 + t]), > (1/2)*(-Sign[1 + t] + Sign[3 + t] + > 12*(-UnitStep[-2 + t] + > (E*UnitStep[-2 + t] - UnitStep[t])/ > E^(t/2) + UnitStep[t]))}, > {t, -10, 10}, PlotRange -> All] > > The Plots are NOT the same, so what worked for Wolfgang in Mathematica 4.0 > doesn't work in 5.0.1. > > His Integrate with Assumptions gives yet a third expression (after a > LOOOONG calculation): > > eq1 = Integrate[x[a]*h[t - a], > {a, -Infinity, Infinity}, > Assumptions -> t \[Element] Reals] > > (1 + t + Abs[1 + t])/(-2 - 2*t) + > (3 + t + Abs[3 + t])/(6 + 2*t) - > 3*((2 - 2*E^(1 - t/2))* UnitStep[-2 + t] + > 2*(-1 + E^(-t/2))*UnitStep[t]) > > This one plots the same as eq2+eq3, so that solves the problem.... > > ...IF we're convinced the original eq1 was wrong and the other two answers > are right. > > I can't muster much confidence in that. > > Bobby > > On Mon, 8 Nov 2004 03:13:30 -0500 (EST), symbio <symbio at has.com> wrote: > >> actually this is different, i used both assumptions and simplify but >> won't >> work. Please try running the code, you'll see for yourself when you look >> at >> the plots, they are different even if you use assumptions. >> >> "David W. Cantrell" <DWCantrell at sigmaxi.org> wrote in message >> news:cmklju$jk2$1 at smc.vnet.net... >>> "symbio" <symbio at sha.com> wrote: >>>> Below I define two functions x[t] and h[t], then in eq1 I integrate >>>> the integrand ( x[tau] h[t-tau] ) from -inf to +inf and get one set of >>>> results and plots, then I integrate the same integrand as before but >>>> this >>>> time in two steps, once from -inf to 0 and once from 0 to +inf, but the >>>> results and plots from the integration performed in two steps are NOT >>>> the >>>> same as the results and plots from integration in one step. Is this a >>>> bug and if so what's the work around? >>> >>> This looks essentially like what you asked here about two weeks ago in >>> "Integration of UnitStep has bugs!? help!" >>> >>> <http://groups.google.com/groups?threadm=clneor%24obq%241%40smc.vnet.net> >>> >>> I would have answered your question in the previous thread had you not >>> already gotten two good answers. Look at them carefully. I suspect that >>> the >>> trouble you're having now is the same as you were having previously; if >>> so, >>> then your question has already been answered, twice. >>> >>> David >>> >>>> Try this in the input cell >>>> >>>> In[19]:= >>>> x[t_] = (3Exp[-.5t]UnitStep[t]) + DiracDelta[t + 3] >>>> h[t_] = UnitStep[t] - UnitStep[t - 2] >>>> eq1 = Integrate[x[\[Tau]]h[t - \[Tau]], {\[Tau], -\[Infinity], >>>> \[Infinity]}] Plot[eq1, {t, -10, 10}, PlotRange -> All] >>>> eq2 = Integrate[x[\[Tau]]h[t - \[Tau]], {\[Tau], 0, \[Infinity]}] >>>> Plot[eq2, {t, -10, 10}, PlotRange -> All] >>>> eq3 = Integrate[x[\[Tau]]h[t - \[Tau]], {\[Tau], -\[Infinity], 0}] >>>> Plot[eq3, {t, -10, 0}, PlotRange -> All] >>>> >>>> You will get the following output expressions (I couldn't paste the >>>> plots >>>> here, but if you run the above input cells you should get the plots >>>> too, >>>> then it will be more obvious what the problem is) >>>> >>>> Out[21]= >>>> \!\(1\/2\ \((1 + \(6.`\ \@\((\(-2\) + t)\)\^2\)\/\(\(\(2.`\)\(\ >>>> \[InvisibleSpace]\)\) - 1.`\ t\) + \(6.`\ \@t\^2\)\/t + \@\((3 + >>>> t)\)\^2\/\(3 \ >>>> + t\) - \(1 + t + \@\((1 + t)\)\^2\)\/\(1 + t\))\)\) >>>> >>>> Out[23]= >>>> \!\(\((\(-6.`\) + >>>> 16.30969097075427`\ \[ExponentialE]\^\(\(-0.5`\)\ t\))\)\ UnitStep[\ >>>> \(-2\) + t] + \((\(\(6.`\)\(\[InvisibleSpace]\)\) - >>>> 6.`\ \[ExponentialE]\^\(\(-0.5`\)\ t\))\)\ UnitStep[t]\) >>>> >>>> Out[25]= >>>> \!\(1\/2\ \((\(-\(\(1 + >>>> t\)\/\@\((1 + t)\)\^2\)\) + \(3 + t\)\/\@\((3 + t)\)\^2)\)\) >>> >> >> >> >> > > > > -- > DrBob at bigfoot.com > www.eclecticdreams.net >

**References**:**Re: need help with integration***From:*"symbio" <symbio@has.com>