Integrate using UnitStep[*]

*To*: mathgroup at smc.vnet.net*Subject*: [mg34901] Integrate using UnitStep[*]*From*: michael_chang86 at hotmail.com (Michael Chang)*Date*: Wed, 12 Jun 2002 02:15:33 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Hi, I recently read with interest the postings on how to define piecewise continuous functions of, say, one variable using UnitStep or Condition (/;). Since I need to perform integration, I've tried to use UnitStep in the simple functions f[x] and g[x] defined below using Mathematica 4.1 for Winduh XP (x,y are both supposed to be Real numbers). In[1]:= f[x_]:=1/40(4(-100+x)UnitStep[x-100]+(355-4x)UnitStep[x-90]+(45-4x)UnitStep[x-10]+4x UnitStep[x]); In[2]:= g[x_]:=UnitStep[x-500]; A couple of things perplex my little mind ... the first being that In[3]:= Integrate[f[x],{x,0,5000}] works and correctly evaluates to 100, but In[4]:= Integrate[f[x],{x,0,\[Infinity]}] remains unevaluated due to warnings such as Out[4]:= Integrate::idiv : Integral of -100+x does not converge on {100,\[Infinity]} (I've cut out the other Integrate warnings for brevity) It appears that Mathematica is trying to actually integrate the individual UnitSteps, thereby resulting in some indeterminate results ... is this correct, and if so, is there a way around this? Secondly, I want to integrate f[x-y]*g[x] over x (I kinda want something like convolution, but not quite ...), so I define In[5]:= ans=Integrate[f[x-y] g[x],{x,0,5000}]; However when I try something like In[6]:= Plot[ans,{y,0,1000}]; I get a NIntegrate::inum warning *and* a Graphics output, but I get no warning *and* a Graphics output when I try In[7]:= Plot[Evaluate[ans],{y,0,1000}]; I was just wondering why do these two situations arise? Again, the collective wisdom of this group is most appreciated! Michael