# integral of $\text{abs}(\sin(x))$ explanation

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.

• Never trust a computer ;) – Dunham Jun 25 '19 at 23:51
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)]$$
which is absolutely continuous and satisfies $$\int_a^b |\sin(x)|dx = F(b) - F(a)$$.
• @Yay Yes. While their answer does have the property that its derivative is equal to $|\sin(x)|$ at every place where it's differentiable, their answer is not everywhere differentiable (or even everywhere continuous). This function is differentiable everywhere and everywhere that derivative is equal to $|\sin(x)|$. – eyeballfrog Jun 26 '19 at 12:08
• @Yay Yes, but $-\cos(x)\mathrm{sgn}[\sin(x)]$ is not. – eyeballfrog Jun 27 '19 at 14:50