## Constant function Integrate Assumption

### Constant function Integrate Assumption

With[{Months = 1}, Integrate[UnitStep[t Months], t]]

Integrate[UnitStep[t Months], t, Assumptions -> Months == 1]

Integrate[UnitStep[t Months] /. Months -> 1, t]

Integrate[UnitStep[t Months] /. x_*Months -> x, t]

Bob Hanlon

<< I am trying to use units within an Integration and would like
Mathematica to understand that the units (Month) are not a function of
the integration variable, but I have not had any luck with my
attempts.

Specifically

Integrate[UnitStep[t Months], t]

should yield

t UnitStep[t]

but I get the unevaluated form, because Mathematica does not know how to
assume that Month is not a function of t.

I've tried Assumptions, SetAttribute, Replace...to no avail. I've
also hunted extensively online (Wolfram, this group and MathGroup)
without any results, so any help would be greatly appreciated.

### Constant function Integrate Assumption

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:= Integrate[t Month, t]

Out= (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:= Integrate[UnitStep[Pi t], t]

Out= t UnitStep[t]

works as desired because Mathematica knows that Pi>0. We also see that

In:= a=-3; Integrate[UnitStep[a t], t]

Out= 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:= Clear[a]; Assuming[a>0,Integrate[UnitStep[a t], t]]

Out= 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

### Constant function Integrate Assumption

"Daryl Reece" < XXXX@XXXXX.COM > schrieb im Newsbeitrag

In:= Months /: t Months = t;
In:= Integrate[UnitStep[t Months], t]
Out= t UnitStep[t]

--
Peter Pein, Berlin
StringReplace[" XXXX@XXXXX.COM ",

### Constant function Integrate Assumption

my solution :

In:=Unprotect[UnitStep];
UnitStep[t_*unit_ /; MemberQ[Attributes[unit],Constant]]:=UnitStep[t];
Protect[UnitStep];

In:=SetAttributes[Months,Constant];

In:=Integrate[UnitStep[t Months],t]
Out=t UnitStep[t]

hth

### Constant function Integrate Assumption

The closest I can get to it is:

Integrate[UnitStep[s Month],{s,-Infinity,t},Assumptions->Month>0]

t UnitStep[Month t]

(Note that since

D[Integrate[UnitStep[s*Month], {s, -Infinity, t}], t]

UnitStep[Month*t]

it is reasonable to view Integrate[UnitStep[s Month],{s,-Infinity,t}]
as the same as Integrate[UnitStep[t Month], t].)

Andrzej Kozlowski
Chiba, Japan
http://www.yqcomputer.com/ ~akoz/

### Constant function Integrate Assumption

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:= Integrate[t Month, t]

Out= (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:= Integrate[UnitStep[Pi t], t]

Out= t UnitStep[t]

works as desired because Mathematica knows that Pi>0. We also see that

In:= a=-3; Integrate[UnitStep[a t], t]

Out= 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:= Clear[a]; Assuming[a>0,Integrate[UnitStep[a t], t]]

Out= 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