2
$\begingroup$

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}]

enter image description here

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$?

$\endgroup$
4
  • 1
    $\begingroup$ A very limited solution: Assuming[0 <= a < 2 π, FullSimplify[Integrate[PiecewiseExpand[Abs[Sin[a - t]]], {t, 0, 2 π}]]] $\endgroup$ Mar 25, 2017 at 17:37
  • 1
    $\begingroup$ @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. $\endgroup$
    – vapor
    Mar 25, 2017 at 17:58
  • $\begingroup$ This looks like a bug. Wrapping the result in an unnecessary ConditionalExpression is excusable, but giving an incorrect answer is not. $\endgroup$
    – mikado
    Mar 25, 2017 at 20:49
  • $\begingroup$ @mikado I agree, I have reported this issue to support: case 3869442 $\endgroup$
    – vapor
    Mar 26, 2017 at 6:26

1 Answer 1

3
$\begingroup$

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, 
             Simplify[Integrate[Abs[Sin[b + k 2 π - t]], {t, 0, 2 π}]]]

    (*  4  *)
$\endgroup$
3
  • $\begingroup$ Hah, manually taking a Mod[]... $\endgroup$ Mar 26, 2017 at 3:21
  • 2
    $\begingroup$ 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. $\endgroup$
    – vapor
    Mar 26, 2017 at 6:21
  • $\begingroup$ The aim should not be to get the correct answer for a restricted range of a, but for all real a. Therefore a == b + k * 2 * Pi, which is valid for all real a. $\endgroup$
    – Akku14
    Mar 26, 2017 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.