How to construct discontinuous derivative with piecewise-polynomials? Problem :
Construct differentiable function with piecewise-polynomials, but it has discontinuous derivative.
My Attempt
At first I tried to make similar one of : $$x\to x^2\sin\left(\frac{1}{x}\right)$$
Since $x^2$ is already polynomial, I tried to imitate $\sin$ part with
$$f\quad \colon\quad
 x\to (-1)^n2^n\left(x-\frac{1}{2^{n+1}}\right)\left(x-\frac{1}{2^n}\right)\quad \left(\frac{1}{2^{n+1}} \le x \le \frac{1}{2^n}\right)$$ for each $n \in \mathbb{N}$.
Then $f$ is differentiable for $x\neq 0$.
And I have problems :

*

*How can I find $f$ is bounded or not? (to find $f$ is continuous or not at $x=0$)

(I tried to bound it with $x^2$ but I dont think its valid because $x^2$ is convex but the $f$ switches convex and concave infinitely many times )


*(If $f$ is continuous  at $x=0$) Can I construct discontinuous derivative with $f$ and something?


*If I can't for '2', Is there any piecewise-polynomial which has discontinuous derivative?
 A: Your example looks like $x \mapsto x \sin(1/x)$. This function is continuous but not differentiable at the origin.
The key point in the example $x \mapsto x^2 \sin(1/x)$ is that the local extrema are attained for $x$ such that $\sin(1/x) = 1$ and thus lie on a parabola.
Let us compute the extrema in your example. For a polynomial $x \mapsto (x-a)(x-b)$, the derivative is zero for $x = (a+b)/2$ and the absolute value of the function at this point is $(b-a)^2/4$. We have $a=1/2^{n+1}$, $b = 1/2^n$ so that the extremum of $f$ in the interval $[a,b]$ is attained at $x = 3/2^{n+2}$ and
$$
\left|f\Bigl({3\over 2^{n+2}}\Bigr)\right| = 2^n {(1/2^n-1/2^{n+1})^2\over 4} = {1 \over 2^{n+4}} = {1 \over 12} ({3\over 2^{n+2}})
$$
The extrema lie on the line $y=x/12$ and not on a parabola.
So $f$ is bounded but the derivative is not continuous at zero, since the variation ${f(3/2^{n+2}) - f(0) \over 3/2^{n+2}}$ takes alternatively the values $-1/12$ and $1/12$.
If you want an example close to the $x^2\sin(1/x)$ map, you can remove the leading coefficient $2^n$. Then the extrema will be on a parabola. You lose the continuity of the derivative at the points $1/2^n$, I don't know if you see it as a problem. By looking at higher degree polynomials, this continuity could be restored.
Anyway, once the extrema are on a parabola, the function $f$ can be studied in the same manner as the function $x^2 \sin(1/x)$ so as to reach the same conclusions.
