# Is it common to see a function which is twice(or higher, say 3rd, 4-th, ...)-differentiable but NOT infinitely differentiable?

Let $c\in E\subseteq \Bbb R$, $f:E\to\Bbb R$. Suppose $k\in\Bbb N$ and $k\geq 2$, and $f$ is $k$-differentiable at $c$ (i.e., $f$ is $(k-1)$-th differentiable on a neighborhood of $c$, and $k$-th differentiable at $c$.) And suppose $f$ is not infinitely differentiable at $c$.

Theoretically, there is nothing suprising that such $f$ exists. However, in practice, do we actually have some chance to see or to deal with such functions? For example, $\sin,\cos, e^x$, polynomials, power functions, ...etc, are infinitely differentiable, and the functions made up by using them with operations($+,-,\times,/,\circ$, etc) are usually good enough. And even those functions that are not infinitely differentiable, are frequenly "too bad" that even not being "twice-differentiable" or "differentiable". So that's where my question arises, is it common to see a function, not so bad, which is twice(or higher, say $3$rd, $4$th, ...)-differentiable, but even not so good, that cannot be infinitely differentiable?

Consider the function $$f(x) = \sum_{n=0}^\infty \Big(-\frac{54^{-n} \sin(3^n \pi \, x)}{\pi^3} + \frac{c_1 x^2}{2} + c_2 x + c_3 \Big)$$

We can differentiate this three times:

$$f'(x) = \sum_{n=0}^\infty \Big(- \frac{18^{-n} \cos(3^n \pi \, x)}{\pi^2} + c_1 x + c_2 \Big)$$

$$f''(x) = \sum_{n=0}^\infty \Big(\frac{6^{-n} \sin(3^n \pi \, x)}{π} + c_1 \Big)$$

$$f'''(x) = \sum_{n=0}^\infty 2^{-n} \cos(3^n \pi \, x)$$

That last one, $f'''(x)$, is a Weierstrass function, which is continuous everywhere but differentiable nowhere. I don't know if you'd consider $f(x)$ to be a "bad" function, since it is just made up of compositions/sums of elementary functions.

Note that $f(x)$ itself is integrable, so I imagine that you could continue integrating it to find more functions that are $k$-differentiable.