Providing additional information for Mathematica to simplify expressions

Sometimes we know that some variables are positive or natural numbers or real, and this helps to simplify expressions. For example,

Integrate[Sign[x], {x, -l/2, l}]


assessed as

 1/2 l (-3 + 6 DiscreteDelta[l] + 2 HeavisideTheta[-l] + 
 4 HeavisideTheta[l]), l \[Element] Reals]


But if I know that l is a real positive number, I actually look at -l / 2. Is there a way to specify this additional information or limitation so that Mathematica can simplify the expression?


source to share

2 answers

It will usually evaluate faster if you include Assumptions

inside Integrate


Integrate[Sign[x], {x, -l/2, l}, Assumptions -> l > 0]




I found the answer, you can provide guesses like

Simplify[Integrate[Sign[x], {x, -l/2, l}], l > 0]


which boils down to l/2




All Articles