# Strange results by integrating Abs[Sin[a - t]]

I have a (simple) integral with a unknown parameter a: $$\int_0^{2\pi}|\sin(a-t)|dt$$ One can observe that it is just two times the area under sin curve from $0$ to $\pi$ and the result is $4$, Integrate agrees with it when given exact values of a.

However, when I try to evaluate this integral directly, Integrate[Abs@Sin[a - t], {t, 0, 2 Pi}] won't finish running. When I try to give it assumptions, interesting results appeared:

Table[Integrate[Abs@Sin[a - t], {t, 0, 2 Pi}, Assumptions -> a > i], {i, -8, 8, 2}]
Table[Integrate[Abs@Sin[a - t], {t, 0, 2 Pi}, Assumptions -> a < i], {i, -8, 8, 2}]


It just gives $0$, and generates the condition with the nearest feasible $k\pi,k\in \mathbb Z$.

I am using version 11.1 on OSX, is there any problem with my usage? How can I get the result $4$?

• A very limited solution: Assuming[0 <= a < 2 π, FullSimplify[Integrate[PiecewiseExpand[Abs[Sin[a - t]]], {t, 0, 2 π}]]] Mar 25, 2017 at 17:37
• @J.M. Nice observation for the assumption intervals. Now I found Integrate[Abs[Sin[a - t]], {t, 0, 2 \[Pi]}, Assumptions -> 0 < a < 23 Pi] generates Boole expressions that can be simplified to correct result, while parameters larger than 24, Integrate[Abs[Sin[a - t]], {t, 0, 2 \[Pi]}, Assumptions -> 0 < a < 24 Pi] directly gives wrong result. It could be that Mathematica gives up because the increasing size of the Boole expressions. Mar 25, 2017 at 17:58
• This looks like a bug. Wrapping the result in an unnecessary ConditionalExpression is excusable, but giving an incorrect answer is not. Mar 25, 2017 at 20:49
• @mikado I agree, I have reported this issue to support: case 3869442 Mar 26, 2017 at 6:26

Extending the answer of @J. M.♦ you can write the a as a == b + k * 2 * π and you will get the right general solution:
    Assuming[0 <= b < 2 π && k ∈ Integers,

• Hah, manually taking a Mod[]... Mar 26, 2017 at 3:21
• Actually given the parameter a short interval assumption, e.g. Integrate[Abs[Sin[a - t]], {t, 0, 2 \[Pi]}, Assumptions -> 0 < a < 2 Pi] // FullSimplify is enough to get the correct answer. Mar 26, 2017 at 6:21