# Simplifying symbolic expression with Heaviside step function

When inputing

Integrate[HeavisideTheta[s - t], {s, 0, 1}, Assumptions -> {t > 0}]


Mathematica correctly simplifies if to

-(-1 + t) HeavisideTheta[1 - t]

even though I did not explicitly ask it to Simplify. However, if I include an undefined function of the variable integrated over, x[s], Mathematica returns a wrong (or, rather, incomplete) result:

Integrate[HeavisideTheta[s - t] x[s], {s, 0, 1},  Assumptions -> {t > 0}]


ConditionalExpression[0, t > 1]

Is there any way to fix this, e.g. leaving the expression unsimplified in the cases where indeed no simplifications can be made a priori?

• Can you explain what answer you expect to see? – bill s Aug 22 '19 at 3:26
• It would be enough to leave it unevaluated, in such a way that if I then assign the function x[s] and Simplify I get the correct result. – sdnnds Aug 22 '19 at 12:20

One approach is to define your integral as a function, which you can then call with your desired x[s]:

myHeavy[x_] := Integrate[HeavisideTheta[s - t] x, {s, 0, 1}, Assumptions -> {t > 0}];


Now, when you want to call this with a function x[s] = s^2, you evaluate

myHeavy[s^2]


To evaluate with Sin[s]

myHeavy[Sin[s]]


These seem to return plausible answers.