[Math] integral of $\text{abs}(\sin(x))$ explanation

calculusdefinite integralsintegration

I know form wolfram alpha: https://www.wolframalpha.com/input/?i=integral+of+abs(sin(x)) that the integral is $-\cos(x)\text{sgn}(\sin(x))$ where sgn$(x)$ is the sign of x, sgn function explained on this link: https://www.wolframalpha.com/input/?i=integral+of+abs(sin(x)) what I do not understand is that the definite integral between $a$ and $b$ of $f(x)$ is $F(b)-F(a)$ so that means that the definite integral between $0$ and $128\pi$ would be $-\cos(100)\text{sgn}(\sin(100)) – (-\cos(1)\text{sgn}(\sin(1)))$ which simplifies to $1.40262117816…$ which makes no sense because if you look at the graph: https://www.desmos.com/calculator/mw6fqfazam makes no sense. can somebody please explain this to me.

Best Answer

Really WolframAlpha is just wrong here. An antiderivative must be absolutely continuous, and $F(x) = -\cos(x)\mathrm{sgn}[\sin(x)]$ isn't. The correct antiderivative (up to an additive constant) is

$$ F(x) = 2\left\lfloor\frac{x}{\pi}\right\rfloor - \cos(x)\mathrm{sgn}[\sin(x)], $$

with $F(x) = x - 1 $ for integer $x$. This is absolutely continuous and satisfies $\int_a^b |\sin(x)|dx = F(b) - F(a)$.