Antiderivative of $|\sin(x)|$ Because $$\int_0^{\pi}\sin(x)\,\mathrm{d}x=2,$$ then $$\int_0^{16\pi}|\sin(x)|\,\mathrm{d}x=32.$$
And Wolfram Alpha agrees to this, but when I ask for the indefinite integral $$\int|\sin(x)|\,\mathrm{d}x,$$ Wolfram gives me $$-\cos(x)\,\mathrm{sgn}(\sin(x))+c.$$ However, $$[-\cos(x)\,\mathrm{sgn}(\sin(x))]_0^{16\pi}=0,$$ So what's going on here? What is the antiderivative of $|\sin(x)|$?

let $$f(x) = \int_0^x |\sin x| \, dx = (1-\cos x), 0\le x \le \pi.$$  since the integrand is $\pi$-periodic, we can extend the formula for $$f(x) = f(\pi) + f(x-\pi), \pi \le x \le 2\pi$$ and so on. you can verify that $$f(n\pi) = 2n  \text{ for all integer } n.$$
 in particular $f(16\pi) = 32.$
