Calculate the derivative $f(x)=\lfloor x\rfloor(\sin(\pi x))^{2}$ I have a problem with this task because answer which I have does not match the right answer and I don't know where is a mistake.My try:For $x\in \mathbb Z$ $f'_{+}(x)=f'_{-}(x)=0$ so $f'(x)$ exist For $x \in (n,n+1), n \in \mathbb Z, f(x)=n(\sin(\pi x))^{2}$  So\begin{align}f'(x)&=1\cdot n^{0}(\sin(\pi x))^{2}+n((\sin(\pi x))^{2})'\\&=(\sin(\pi x))^{2}+n2\sin(\pi x)\cos(\pi x)\\&=(\sin(\pi x))^{2}+\sin(2\pi x)n\end{align}In the answer is: $f'(x)=n \pi\sin(2\pi x)$ and then $f'(x)=\lfloor x\rfloor\pi\sin(2\pi x)$ because for $x \in \mathbb Z$ $f'(x)$ also exist.Why?
 A: Why $n^0$? If, in $(n,n+1)$, $f(x)=n\sin^2(\pi x)$, then, in that interval$$f'(x)=2n\pi\sin(\pi x)\cos(\pi x)=n\pi\sin(2\pi x).$$Don't forget that $n$ is a constant here.
A: The function to be differentiated is
$$f(x) = \lfloor x\rfloor \sin(\pi x)^2$$
By the product rule we have
$$f'(x) =a(x) + b(x)$$
where
$$a(x) =\lfloor x\rfloor \left(2 \pi \sin(\pi x) \cos(\pi x) \right)=\lfloor x\rfloor \left( \pi \sin(2\pi x)\right)  $$
$$b(x) = \sin(\pi x)^2 \left( \frac{d}{dx} \lfloor x\rfloor \right)$$
Now it is not difficult to see that the derivative of the floor function produces a Dirac delta function at each integer point. 
Hence
$$\left( \frac{d}{dx} \lfloor x\rfloor \right)= \sum_{k=-\infty}^\infty \delta(x-k)$$
But since 
$g(x) \delta(x-k) = g(k)$  and $\sin(\pi k)=0$ we have $b=0$
and the derivative is
$$f'(x) =\lfloor x\rfloor  \pi \sin(2\pi x) $$
This derivative reproduces $f(x)$ on integrating. For example
$$\int_{-\frac{1}{2}}^{\frac{3}{2}} f'(x) \, dx = 2$$
which agrees with
$$f(\frac{3}{2}) - f(-\frac{1}{2}) = 1 - (-1) = 2$$
Remark
As an answer to a comment I'd like to add that my approach also treats the more general case where
$$f(x) = \lfloor x\rfloor  h(x)$$
and
$$f'(x) = \lfloor x\rfloor h'(x) +  h(x) \sum_{k=-\infty}^\infty \delta(x-k)\\=
\lfloor x\rfloor h'(x) + \sum_{k=-\infty}^\infty h(k)\delta(x-k)$$
