One way to cut through this Gordian knot is to simply not use units in
symbolic expressions. I always consider units to be part of the data and not
a symbolic variable. (It just makes no sense to treat a unit as a symbolic
variable. Is month going to change to Meter? True, 12 Month might change to
1 Year but that just illustrates that the number value and the unit go
together.)
The V4ExtendUnits package at my web site handles units in UnitStep and
DiracDelta (provided that the arguments evaluate to a single number with a
unit), essentially by deunitizing the expressions. So, for this particular
case one could use...
Needs["Miscellaneous`V4ExtendUnits`"]
data = {t -> 3.5 Month};
Integrate[UnitStep[t], t]
% /. data
% // ToUnit[Month]
t UnitStep[t]
3.5 Month UnitStep[3.5 Month]
3.5 Month
Here is a more complicated example...
(data = {a0 -> 5 Watt Second, a1 -> 10 Watt/Second, t0 -> 1/4 Second,
t1 -> 1/2 Second, ti -> 0, tf -> 1 Second});
power[t_] := a0 DiracDelta[t - t0] + a1 t UnitStep[t - t1]
Integrate[power[t], {t, ti, tf}];
Simplify[%, tf > ti]
% /. data // ToUnit[Joule]
(1/2)*a1*UnitStep[-t1 + tf]*((-t1^2 + tf^2)*UnitStep[t1 - ti] +
(tf - ti)*(tf + ti)*UnitStep[-t1 + ti]) +
a0*UnitStep[-t0 + tf, t0 - ti]
8.75 Joule
David Park
XXXX@XXXXX.COM
http://www.yqcomputer.com/ ~djmp/
From: David W. Cantrell [mailto: XXXX@XXXXX.COM ]
Not exactly. I'll explain in a moment.
Yes, you get an unevaluated form, but that's not due to Mathematica
thinking that Month (or Months, whichever) might be a function of t.
Consider, for example,
In[1]:= Integrate[t Month, t]
Out[1]= (Month t^2)/2
showing that Mathematica assumes, just as you wish, that Month is
independent of t.
The problem with something like Integrate[UnitStep[t Month], t] seems to
be that we cannot convince Mathematica that Month is positive unless we
actually specify a numerical value for it. Note first that
In[2]:= Integrate[UnitStep[Pi t], t]
Out[2]= t UnitStep[t]
works as desired because Mathematica knows that Pi>0. We also see that
In[3]:= a=-3; Integrate[UnitStep[a t], t]
Out[3]= t-t UnitStep[t]
is correct because Mathematica knows that a<0.
Prior to your posting, I would have thought that the following would work:
In[4]:= Clear[a]; Assuming[a>0,Integrate[UnitStep[a t], t]]
Out[4]= Integrate[UnitStep[a t], t]
but we see, alas, that it doesn't work. So can someone suggest a way to
get Integrate[UnitStep[t Month], t] to evaluate to t UnitStep[t] without
having to assign a specific positive value to Month?
David Cantrell